nodejs-microservice-starter

NodeJS RESTful API Microservice

Usage no npm install needed!

<script type="module">
  import nodejsMicroserviceStarter from 'https://cdn.skypack.dev/nodejs-microservice-starter';
</script>

README

NodeJS RESTful API Microservice Starter v1.1.0

This repository contains a full configuration that runs NodeJS RESTful API Microservice Starter.

Build Status Coverage Status Dependency Status Dev-Dependency Status

Requirements

Build for local development

You have to use the following command to start a development server:

npm run dev

See package.json for more details.

Build for staging and production environments

Use following command to build project:

npm run build

Use following command to start project on staging and production environments:

npm start

See package.json for more details.

Tests

Following tests libraries are used for unit/integration tests:

Tests are kept next to source with following pattern *.spec.js

Use following command to run tests:

npm test

Use following command to run tests coverage:

npm run coverage

Docker container

There is available Docker container and Docker Composer if you would like to run many NodeJS Microservices.

Build API Microservice by using following command:

npm run build

Then use following command to build Docker containers:

docker-compose up -d --build

See Dockerfile and docker-compose.yml for more details.

Deployment

Heroku

  • Build Microservice by using following command npm run build
  • Go to builded directory dist
  • Download and install Heroku Toolbelt
  • Log in to Heroku by using following command heroku login
  • Run following command heroku create
  • Run following command heroku addons:create mongolab to add MongoDB to your application.
  • Run following command git push heroku master to push your application to Heroku.

TODO

  • #2 API Authentication oAuth2
  • #3 Waterline ORM
  • #5 100% Test Coverage