Service-template-node/UsefulCommands

= Useful Commands =

npm 101
npm is the package manager for Node.js modules. It is used for managing and publishing modules.

The template (and your future service) needs its dependencies to be present. Install them with: Sometimes the configuration can get a bit messed up you may experience strange npm-related errors when running your service. The remedy is: If you need to add a dependency, this will install it and add it your :

Service-related Tasks
The template comes with some handy  tasks. To start your service based on the configuration in, use simply: Starting unit tests is as easy as: A code coverage utility is also available: Once the script finishes, open up  which will show you detailed reports about which lines of code have been covered by the unit tests.

Docker
Included in the template is also a Dockerfile, allowing you to run and test your service in a production-like environment inside of a Docker container. You need to have docker installed if you are on a Linux host, or boot2docker in case of OSX/Windows hosts.

To start your service in the container, execute: The first time you run it, it takes a while as the script automatically builds the full image and then starts the service.

If you want to test your service instead, use: Similarly, to run code coverage, run: Note: On Linux hosts, running  requires superuser rights, so you may need to prefix the commands with. If you are on a Ubuntu box, you may circumvent that by adding yourself to the  group: After you log out completely and log back in, you should be able to run the above scripts without resorting to.

Deployment
See this document for how to get ready to deploy your service.