Skip to content

Example Node.js CRUD microservice for an Employee entity

Notifications You must be signed in to change notification settings

berezine81/employee-microservice-node

This branch is up to date with omerio/employee-microservice-node:master.

Folders and files

NameName
Last commit message
Last commit date
Sep 5, 2017
Mar 24, 2017
Sep 5, 2017
Mar 16, 2017
Mar 24, 2017
Mar 18, 2017
Sep 5, 2017
Mar 16, 2017
Mar 16, 2017
Mar 16, 2017
Mar 18, 2017
May 27, 2018
May 27, 2018
Apr 28, 2017
Mar 24, 2017
Jul 27, 2019
Sep 30, 2019

Repository files navigation

employee-microservice-node

CircleCI codecov

Example Node.js CRUD microservice for an Employee entity with unit tests, mocking, code style checking and good test coverage. The microservice exposes REST APIs which are documented using Swagger.

Getting Started

Requirements:

Checkout and run the code

git clone https://github.com/omerio/employee-microservice-node.git
cd employee-microservice-node
npm install
npm start

Once the server is started you can access the following URLs:

Alt text

Libraries

The following libraries are used in this project:

Available build scripts

The available scripts are in the package.json file:

  • npm start - start the application
  • npm run dev - start the application in development mode, e.g. application reloads each time a change is made.
  • npm test - run the unit tests, the results are printed to the screen
  • npm run test-ci - run the unit tests, the results saved to a file to use in a Continous Integration tool
  • npm run test-debug - run the tests enabling debug mode
  • npm run coverage - run the code coverage
  • npm run debug - run the app in debug mode
  • npm run lint - run linting of the application code

Unit Tests and Coverage

To run the unit tests

npm test

The test results are printed to the screen. To produce the test results in junit format use the npm run test-ci script

To generate the code coverage reports:

npm run coverage

The coverage reports are available in HTML format in employee-microservice-node/coverage/index.html

CI-CD

This repository uses CircleCI for continuous integration and deployment. Circle CI configuration is in the circle.yml file

Code coverage results are uploaded to CodeCov.

Docker

This microservice can be built as a docker container. See the Dockerfile

To build a docker image:

docker build -t omerio/employee-microservice-node .

To run the docker image:

docker run -p 8000:8000 omerio/employee-microservice-node

Publish the image to Docker Hub, using your Docker Hub login details:

docker login
docker push omerio/employee-microservice-node

TODO

  • Continuous deployment using CircleCI
  • Add authentication
  • Add JSDocs support

About

Example Node.js CRUD microservice for an Employee entity

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 98.8%
  • Dockerfile 1.2%