A complete TDD setup of Node.js + Express server development
- A Node.js + Express server which check if a number is prime or not
- Unit testing using mocha and chai assertion library
- Code coverage using nyc, travis, coveralls
- Travis build configuration
- Containerize server using docker
- Auto deployment of docker image to docker hub
- Auto deployment of server to Heroku
This microservice server reads the number in the request query and does a primality check of that number. It responses a json indicating the number is a prime or not.
In Hekuro environment
- Go to https://nodejs-primality.herokuapp.com/primality/197 in your browser or by other means
- The http response is { "Number": "197", "Primality": true }
In Docker environment
- Install docker in your box
- Execute "Docker run -p 3000:3000 --name primality jerrytfleung/primality"
- Go to http://localhost:3000/primality/197 in your browser or by other means
- The http response is { "Number": "197", "Primality": true }
- Execute "Docker stop primality" to stop the server