Page cover

Express.js

01. Getting start

## ------------------| One Rule to Rule Them All
npx express-generator -f --git 

## ------------------| Create package.json
npm init -f

## ------------------| Install dependencies 
### Install app directory and save it in the dependencies list
npm install express cors nodemon dotenv
### Install temporarily and not add it to the dependencies list
npm install express cors nodemon dotenv --no-save

## ------------------| Changes on package.json
"scripts": {
  "start": "nodemon src/app.js"
}

## ------------------| Create .gitignore file
/node_modules
.env
/.pnp
.pnp.js
/coverage
/build
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
npm-debug.log*
yarn-debug.log*
yarn-error.log* 
  • app.js

02. Register Routes

03. Database Management

03.1 MongoDB

  • Getting started

  • Connect to database

  • Insert data to database [Basic]

  • Insert data to database [Structured]

03.2 SQLiteDB

  • Getting started

  • Create app.js

04. Deploying

  • Process Manager (PM2)

  • For DEV env

  • For PROD env

Last updated

Was this helpful?