Node Express Server Template

This is a templated Node Express server. This can be run locall as a dockerized container or natively through your terminal. For some examples we added a Redis service, controller endpoints, and a unit test. This template is using NodeExpress, Javascript ES7, and TypeScript and a collaboration between Devin Frenze and Brian Vogelgesang

Non-Docker Instructions

Before following the instructions, use [NVM] to make sure you're using the node version specified in the .nvmrc.

Install dependencies

npm i

Local Development

npm run local

Build

npm run build:dev
npm run build:prod

Docker Instructions

Make sure you have docker installed on your local machine.

To run one of the docker environments locally:

npm run docker:dev
npm run docker:prod

To stop the environment:

npm run docker:stop

Testing

Endpoints

Once the server is running (in docker or locally), you can do the following to test the endpoints/services

  • Check if server is running: curl http://localhost:3000/
  • Set values in Redis: curl http://localhost:3000/store/my-key\?some\=value\&some-other\=otvalue
  • Retrieve values from Redis: curl http://localhost:my-key

Linting

npm run lint

or

npm run lint:fix

Unit Tests

npm test

Contributing

We're using a package called "Husky" to do linting and testing on git hooks. See the .huskyrc for more information or to adjust the configuration. Please feel free to add comments or make a PR.