Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mramshaw/hazzard
Another REST API (this time with node.js)
https://github.com/mramshaw/hazzard
chai chai-http mocha node-js nodejs rest rest-api restful
Last synced: about 1 month ago
JSON representation
Another REST API (this time with node.js)
- Host: GitHub
- URL: https://github.com/mramshaw/hazzard
- Owner: mramshaw
- Created: 2019-08-07T00:10:26.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-10-10T06:08:28.000Z (4 months ago)
- Last Synced: 2024-12-21T04:34:02.563Z (2 months ago)
- Topics: chai, chai-http, mocha, node-js, nodejs, rest, rest-api, restful
- Language: JavaScript
- Homepage:
- Size: 906 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 15
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Hazzard
[](http://travis-ci.org/mramshaw/Hazzard)
[](http://github.com/mramshaw/Hazzard/releases)[](https://snyk.io//test/github/mramshaw/Hazzard?style=plastic&targetFile=package.json)
A simple RESTful endpoint with __node.js__ using [express](http://www.npmjs.com/package/express) and [superagent](http://www.npmjs.com/package/superagent).
Testing will be carried out with [Mocha](http://mochajs.org/), [Chai](http://chaijs.com) and [Chai-HTTP](http://www.chaijs.com/plugins/chai-http/).
Logging will be carried out with [morgan](http://www.npmjs.com/package/morgan).
## Configuration defaults
By default the app will run on `localhost` port `5000`, but other values may be specified as follows:
```bash
export HOST=127.0.0.1
```Or:
```bash
export PORT=3333
```## Linting
Code linting will be carried out with [ESLint](https://eslint.org/).
Lint the code as follows:
```bash
npm run -s eslint .
```## Testing
Test the app as follows:
```bash
npm test
```This should look as follows:

Or start the app (npm start) and test with [curl](CURLs.txt).
## Running
Start the app as follows:
```bash
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:

## 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:

After the build has been done, run the docker image as follows:
```bash
docker run --rm -it -e HOST=0.0.0.0 -p 5000:5000 mramshaw4docs/jukeboxes:12.16.2-stretch
```This should look as follows:

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