Node boilerplates for sequelize ORM
- Node 18.0^
npm install or npm i
Step 1: Create environment configuration file:
The schema is define in /config/index.js
- For development, define required variables in development.json.
- For production, define required variables in production.json.
- For test, define required variables in test.json.
Step 2: define the NODE_ENV default is 'development':
export NODE_ENV=development ||export NODE_ENV=production || export NODE_ENV=test
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
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