A template of Node.js Web Server.
- Node 14.0
npm install or npm i
npm start
Or
node server | bunyan #install bunyan globally for good formatting of logs
Or
npm run server (hot reloading)
npm run logs
npm run stop
> npm run lint
> npm run prettier
- For development, define required variables in development.json
- For production, define required variables as environment variable in remote setup.
- If using mySQL for the project, use the following command to
install brew install [email protected]
- You can start mysql services by
brew services start mysql
npm run db:migrate:create migration-name
npm run db:migrate
npm run db:migrate:undo
- Every Database Table should have a corresponding Model file in
models
folder - We use
Sequelize
as our ORM - Use
npx sequelize
to cli for migrations - The
controllers
androutes
folder should exactly mimic each other. All routers inroutes
should have their correspondingcontrollers
file/folder - All logging should be done using
req.log
. It's a bunyan logger. For model level logging,req.log
should be passed to underlying layers