GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Main page
  • Get MediaWiki
  • Get extensions
  • Tech blog
  • Contribute
  • User help
  • FAQ
  • Technical manual
  • Support desk
  • Communication
  • Developer portal
  • Code statistics
  • Community portal
  • Recent changes

This view

  • Original page
  • New address

GeezerVison is showing www.mediawiki.org — Service-template-node/UsefulCommands - MediaWiki

< Service-template-node
This page is outdated.
It was written for an older version of MediaWiki and may not apply to the most recent version. If you have checked or updated this page and found the content to be suitable, please remove this notice.

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:

npm install 

Sometimes the configuration can get a bit messed up you may experience strange npm-related errors when running your service. The remedy is:

rm -rf node_modules npm install 

If you need to add a dependency, this will install it and add it your package.json:

npm install --save <name_of_module> 

Service-related Tasks

The template comes with some handy npm tasks. To start your service based on the configuration in config.yaml, use simply:

npm start 

Starting unit tests is as easy as:

npm test 

A code coverage utility is also available:

npm run-script coverage 

Once the script finishes, open up coverage/lcov-report/index.html 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:

npm run-script docker-start 

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:

npm run-script docker-test 

Similarly, to run code coverage, run:

npm run-script docker-cover 

Note: On Linux hosts, running docker requires superuser rights, so you may need to prefix the commands with sudo. If you are on a Ubuntu box, you may circumvent that by adding yourself to the docker group:

sudo gpasswd -a <your_username> docker 

After you log out completely and log back in, you should be able to run the above scripts without resorting to sudo.

Deployment

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

Retrieved from "https://www.mediawiki.org/w/index.php?title=Service-template-node/UsefulCommands&oldid=7039996"
Category:
  • Outdated pages
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.