This project is intended to be a personal boilerplate, but also built for the community. It will help in further personal projects, having a good fork-able project.
As you will see, there is an example CRUD controller, but no ORM DB library is installed. This is because the project is intended to be the most flexible, allowing the dev to use the
service as it may like the most.
The boilerplate contains the following technologies:
The structure allows the developer to split the code following the single-responsibility principle, so it contains folders for:
constants: the constants that can be created inside the projectcontrollers: folder for the various service controllers;errors: list of errors of the application;mocks: mocks that will be useful mainly for testing;routes: list of routes files;tests: this is the test folder and all the test files placed here will be run by Jest;types: folder for the types declaration in the project;validators: this folder contains validators written in Joi and fungible as middleware.
If you use nvm, in order to use the right node version run:
nvm useAfter this, install the dependencies with:
npm iTo run the server, just execute:
npm startTo run the server in listening mode, run:
npm run devTo run the test suite, just run:
npm testTo build the service, that will produce a /build folder as output, run:
npm build