api-express is a boilerplate which aim to be a learning project (Frafos GmbH FTW ๐).
The api is written in nodejs, using the express framework.
A resilent redis connection is hanlded (unsing ioredis ๐).
CRUD operation are available via a the H* redis operation.
The project can be run in docker, but npm is required if you want to run in developement mode.
The node_modules directory need to be in the root package, but the root directory is also
shared via a volume with the docker.
The dev target of the docker iamge run the code via nodemon, which allow a hot reload of the content.
make buildto build the docker image- npm install to install the node_modules (so it's not missing at runtime)
make runto run the docker imagemake redisto run a redis docker image
Access 127.0.0.1:4242/api/v1/docs :) or curl 127.0.0.1:4242/api/v1/docs.json
make build -e TARGET=prodmake run
A JSON API, contacting redis, serving a swagger doc.
Use of: express, express-prettify, swagger-ui-exoress, swagger-jsdoc, morgan, ioredis, ioredis-mock, dotenv, mocha, chai
| target | description | where |
|---|---|---|
lint |
run eslint | package.json |
lintfix |
run eslint + fixer | package.json |
pretty |
run prettier | package.json |
start |
start the API | package.json |
test |
run the test via mocha | package.json |
swagger |
generate a swagger.json file | package.json |
coverage |
generate code coverage | package.json |
codecov |
generate and publish coverage to codecov | package.json |
Makefile |
The dockerfile hold 2 steps : dev and prod. Provide the --target arguemnt to docker build
to stop at the desired target.