burgesQ/api-express

โ˜… 0Forks 0JavaScriptGitHub โ†—Compare
apiexpressioredisjoinodejsnpm

README

README.md

Build Status codecov

What

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.

Use it

dev

  • make build to build the docker image
  • npm install to install the node_modules (so it's not missing at runtime)
  • make run to run the docker image
  • make redis to 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

prod

  • make build -e TARGET=prod
  • make run

project

nodejs

A JSON API, contacting redis, serving a swagger doc.

external library

Use of: express, express-prettify, swagger-ui-exoress, swagger-jsdoc, morgan, ioredis, ioredis-mock, dotenv, mocha, chai

targets

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

docker

The dockerfile hold 2 steps : dev and prod. Provide the --target arguemnt to docker build to stop at the desired target.

Contributors

burgesQ

Issues