Setting Up a Backend Project with Node.js
Classified in Computers
Written at on English with a size of 5.14 KB.
To start a backend project.
- npm init
Then make a file with whatever entry point you named it as, for example, server.js
Once package.json is created:
- npm i <package>
- connect-mongo (store sessions in DB)
- dotenv (for config files, environment variables)
- express
- mongoose
- express-sessions (sessions and cookies)
- method-override (to use PUT, UPDATE, DELETE requests)
- moments (date formatting)
- morgan (logging)
- passport (authentication)
npm i -D <package>
- nodemon (Update every file change instantly without having to restart the server)
- cross-env (To update environment variables in script definition itself)
After installing the dependencies, edit the scripts in package.json