mramshaw / Hazzard

Another REST API (this time with node.js)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Hazzard

Build status GitHub release

Known Vulnerabilities

A simple RESTful endpoint with node.js using express and superagent.

Testing will be carried out with Mocha, Chai and Chai-HTTP.

Logging will be carried out with morgan.

Configuration defaults

By default the app will run on localhost port 5000, but other values may be specified as follows:

export HOST=127.0.0.1

Or:

export PORT=3333

Linting

Code linting will be carried out with ESLint.

Lint the code as follows:

npm run -s eslint .

Testing

Test the app as follows:

npm test

This should look as follows:

tests

Or start the app (npm start) and test with curl.

Running

Start the app as follows:

npm start

This should make our endpoint available at:

http://localhost:5000/v1/jukeboxes/

As usual, Ctrl-C to stop.

In a browser, this should look something like the following:

browser

Docker

We will use the LTS version (10.16.2-stretch) of node for our Docker build and tests.

Running docker-compose up will trigger a docker build and start the app.

[Ctrl-C and docker-compose down to stop.]

This should look as follows:

docker-compose_up

After the build has been done, run the docker image as follows:

docker run --rm -it -e HOST=0.0.0.0 -p 5000:5000 mramshaw4docs/jukeboxes:12.16.2-stretch

This should look as follows:

docker

To Do

  • Add various badges
  • Dockerize everything
  • Upgrade to latest LTS version of node (12.16.2-stretch)
  • Update dependencies to allow for reported exploits
  • Add code coverage
  • Create an integration with swagger-ui (for exploring the API)

About

Another REST API (this time with node.js)


Languages

Language:JavaScript 97.8%Language:Dockerfile 2.2%