For instruction, please visit:
Node.js CRUD Rest APIs with Express, Sequelize & PostgreSQL example
More Practice:
Node.js Express File Upload with Google Cloud Storage example
Security:
Node.js JWT Authentication & Authorization with PostgreSQL example
Associations:
Fullstack:
Integration (run back-end & front-end on same server/port)
npm install
createdb tutorials-db
Also, rename .env.example
to .env
and change its environment variable values. If not, it will use hard-coded default values:
# Backend port, changed if you need.
PORT=8080
# CORS origin URL, changed if you need.
CORS_ORIGIN=http://localhost:8081
# Database connection configuration
DB_HOST=<your DB_HOST; otherwise, localhost>
DB_USER=<your DB_USER; otherwise, postgres>
DB_USER_PASSWORD=<your DB_USER_PASSWORD; otherwise, empty>
DB_NAME=<your DB_NAME; otherwise, testdb>
node server.js