Skip to content

amrlabib/node-server-boilerplate

Repository files navigation

Node server boilerplate

Node server boilerplate is to help you kick start your node server.

Prerequisite:


Setup:

  1. yarn or npm install
  2. yarn build to remove flow type annotations
  3. yarn start:dev to start server and watch files changes

Other scripts:

  1. yarn json-server to create test json api http://localhost:3001/

Setup using Docker

  1. docker build -t node-boilerplace-image . to build a docker image
  2. docker run -p 80:8080 --name node-boilerplace-container node-boilerplace-image to run the container

Features:

  1. axios to handle all third party api calls if required ['GET','POST','PUT','DELETE', ...]
  2. express web application framework
  3. json-server no need to wait for third party api to start development, use json-server to have test data and test third party api ready for use
  4. nodemon to restart server on any file change during development
  5. mongoose is a MongoDB object modeling tool designed to work in an asynchronous environment.
  6. eslint the project contains eslint with eslint-config-airbnb-base extended, to fix and flag javascript code errors.
  7. flow static type checker for javascript, flow-remove-types is used to remove flow type annotation to a dist server folder that should be deployed.
  8. husky to add pre-commit hook that will trigger yarn lint && yarn flow to make sure no bad commits are pushed

Editor recommendation:

You can use any prefered editor, in case you are using Atom the following packages can help speed up your development process: