Skip to content

Latest commit

 

History

History
109 lines (78 loc) · 2.74 KB

README.md

File metadata and controls

109 lines (78 loc) · 2.74 KB

BADdevs developer guide

Requirements

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

Debian

NodeJS 6

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
Extra tools for Webpack and Typescript

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 
Extra Linux Configs

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

GOlang

# 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
CompileDaemon

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

Run in Development

Run in Development Mode

Run the Server

CompileDaemon -color -command='./baddevs --port 8081 --host 0.0.0.0'

Run Client Generator using Web Pack

# Move to client/ folder
cd client/
# Run npm generator that regenerates based on changes
npm run watch:dev

Run in Production Mode

Run the Server

# Build
go build
# Run
./baddevs --port 80 --host 0.0.0.0

Run Client Generator using Web Pack

# Move to client/ folder
cd client/
# Run npm generator that regenerates based on changes
npm run build:prod