Skip to content
rinzeb edited this page Mar 24, 2016 · 9 revisions

A brief introduction to get you started. In case you have experience in using node.js and TypeScript, you may skip to the end. Otherwise, please read on. For an installation checklist without explanations, go to the installation checklist.

Installation of the web server node.js

We use node.js as our server, even though for most functionality, a server that serves static pages is enough. Download node.js and install it as admin. Node also comes with a default package manager, npm, which you can use to install (globally) our build tool, gulp, and the client side package manager, bower.

npm install –g gulp
npm install –g bower

Optionally, you can also install nodemon, especially when doing server side development. It is a replacement for node and it will automatically restart node when a file has changed.

npm install -g nodemon

Installing TypeScript and an IDE

Install TypeScript using npm or from here.

npm install –g typescript

We are currently using Atom as the preferred IDE, since it is free and has good TypeScript support, but you are free to use any other IDE too that uses typescript's 'tsconfig.json' files to specify what to build. Read more here.

Installing GIT software

In order to download the code, you probably need the GIT version control tool (alternatively, you can download csWeb as a zip file from GitHub). Two popular free alternatives on Windows are SourceTree, and GitHub. SourceTree offers more functionality, but is also a bit more complex. And I like the clean user interface that GitHub offers.

Installing csWeb

With all dependencies set up and running, you can know fork csWeb. Under Windows, you are likely using a GUI, but on OSX or linux you would do something like this:

#!/bin/bash
BASE_FOLDER=~/src/cs
mkdir $BASE_FOLDER
cd $BASE_FOLDER
git clone https://github.com/TNOCS/csWeb
cd -

After installing csWeb, you should first install all dependencies: So go to the root folder, and run updateAll.bat: it first calls npm update and bower update to install the server side and client side dependencies, and further compiles the initial version using the typescript command line compiler tsc.

In case you only wish to run it, go to the example folder, and run node server.js, or alternatively, nodemon server.js and visit http://localhost:3000.

Alternatively, in case you want to make small changes to the example, you can use one of the edit bat files in the example folder to start working on it using Atom. Please make sure that you run gulp too, as it manages the build workflow in the background. The edit command, besides running nodemon and, optionally, gulp, opens three project folders: example, an example client application, csComp, the client library containing all angular services and directives, and csServerComp, the server library containing all server side node components.

If you are ready to roll up your sleeves and really get going, it is probable best if you clone the example folder to a new folder (we normally use the apps\MyApp folder right next to csWeb), in which case you need to edit the gulpfile.js to specify the location of the csWeb folder by setting path2csWeb = .... So we normally end up with something like:

HOME\apps
HOME\apps\MyApp <-- your map client
HOME\csWeb <-- clone of csWeb

When you have something beautiful to share, just issue a pull request, and we will try to merge it with the rest of the code.

Have fun!