Skip to content
This repository has been archived by the owner on Jul 24, 2023. It is now read-only.

doug-wade/example-koa-angular

Repository files navigation

dependenciesGenerated using the Yeoman generator koa-angular

Prerequisites

You must install:

  • any version of node.js version 0.12 or higher
  • gulp (npm install -g gulp gulp-cli)

You should install:

  • the bunyan cli to make the logs readable (npm install -g bunyan).

If you want to continuously run the tests while developing, you may also want:

  • karma (npm install -g karma karma-cli)
  • protractor (npm install -g protractor)
  • mocha (npm install -g mocha)

Starting the server

npm install
gulp

then navigate to localhost:3000 in your favorite browser. If you installed the bunyan cli, then pipe the logs through bunyan to make them more readable:

gulp | bunyan

In production, you should consider using pm2 to start the server to do clustering and monitoring:

npm install -g pm2
pm2 start ./build/app.js -i 0 --name "koa-angular"

Running the tests

npm install
# Download the Selenium webdriver
node_modules/protractor/bin/webdriver-manager update
gulp compile
gulp test

Note that to end the mocha and test tasks, you have to manually interrupt the selenium standalone process (ctrl + c)

Other tasks

Check out the generated gulpfile to discover all the tasks you can run. Most are run as needed by the watch task when you run the default target, but there are a couple of others you may want to run:

# See if any dependencies are out of date
gulp checkDependencies

# Upgrade any out of date dependencies and save them to package.json
gulp upgradeDependencies

# Remove all the generated build code
gulp clean

Note for Node.js v0.x

The gulp mocha target uses generators, which require the --harmony flag on Node.js v0.x. So, to invoke the mocha task or the test task, gulp must be invoked using node, e.g.

node --harmony `which gulp` test
node --harmony `which gulp` mocha