Setup both NodeJS 6 & GOlang
- NodeJS6 : is used to develop the client application on Angular 2, the whole NodeJS6 application is contained in the client/ folder
- GOLang : is used to develop the http server to serve generated Node application html, js, and static files + to fullfil API requests etc
The following commands will setup NodeJS6 on your debian based distribution. For other distribution please check guide
#Install NodeJS
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs
#Install build tools for some NodeJS packages
sudo apt-get install -y build-essential
The following global tools to be able to generate the client project. If you would like to get more information about the project please visit it's page
npm install --global webpack
npm install --global webpack-dev-server
npm install --global karma-cli
npm install --global protractor
npm install --global typescript
npm install --global rimraf
Increase inotify watchers, else during development webpack won't be able to watch changes to most of your files, and so it won't automatically recompile. Check the guide
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
# Install the GOLang binaries
VERSION=1.7.1
OS=linux
ARCH=amd64
tar -C /usr/local -xzf go$VERSION.$OS-$ARCH.tar.gz
#Install GO
#Setup some ENV variables for compiling GO programs
export GOROOT=$HOME/go
export GOBIN=$GOROOT/bin
export GOPATH=$GOROOT
export PATH=$PATH:/usr/local/go/bin:$GOROOT/bin
Install the compile daemon so that whenever you make a change to the go programs, it will automatically detect the change and compile the GO programs.
#Install CompileDaemon locally
go get github.com/githubnemo/CompileDaemon
CompileDaemon -color -command='./baddevs --port 8081 --host 0.0.0.0'
# Move to client/ folder
cd client/
# Run npm generator that regenerates based on changes
npm run watch:dev
# Build
go build
# Run
./baddevs --port 80 --host 0.0.0.0
# Move to client/ folder
cd client/
# Run npm generator that regenerates based on changes
npm run build:prod