This is a simple boilerplate for services, you will find several feature that will help you get running with your service. It is far from perfect, so don't make any hesitation to make PR with your improved and usefull feature.
nvm use
to switch to correct node versionyarn install
yarn husky:setup
before your first run, it will be set up for all future runs- copy and paste
.env.example
into.env
with custom values fitting your context yarn start
Server will start on given port and run with nodemon to allow auto-reload
- NODE_ENV=development
- LOCAL_PORT=8080
- LOCAL_URL=https://localhost:8080
- 8080
- boilerplateservice
Before all you can run nvm use
, it will change your node version to lts based on .nvmrc
. If you haven't installed it yet follow this steps:
nvm install 16.13.0
nvm use
Currently last lts version is 16.13.0
, it will change sooner or later. So when it does, simply change content in .nvmrc
then run nvm install 16.13.0
and nvm use
yarn build
It will build in./build/
yarn husky:setup
It will setup husky to roll before commit If you run it multiple times you will add duplicate pre-commit hooks, so if in a doubt simply delete.husky/
folder and run yarnhusky:setup
:warn: On windows you could run into some trouble to push your change, if so go to ./.husky/pre-push
and add before yarn build
:
if [ -t 1 ]; then
exec < /dev/tty
fi
yarn test
yarn test:watch
yarn test:coverage
yarn swagger:bundle
It will then help to bundle all json documentation files into one swagger.json with the commandyarn swagger:bundle
, after that you can just useyarn swagger:gen
command.
yarn swagger:gen
It will generate a documentation accessible on/apiDocs
and interface relative to app
yarn swagger:full
It will combine swaggerBundle and swaggerGen and run a prettier:fix to clean it all
yarn prettier
yarn prettier:fix
yarn lint
yarn lint:fix