To create an Express app, you will need to install the following npm packages:
1. express: This is the core Express framework that allows you to build web applications.
Code:
bash
npm install express
2. body-parser: This middleware is used to parse incoming request bodies in a middleware before your handlers, available under the req.body property.
Code:
bash
npm install body-parser
3. morgan: This is a HTTP request logger middleware for Node.js that logs requests to the console.
Code:
bash
npm install morgan
4. cors: This is a middleware that can be used to enable Cross-Origin Resource Sharing (CORS) with various options.
Code:
bash
npm install cors
5. dotenv: This is a zero-dependency module that loads environment variables from a .env file into process.env.
Code:
bash
npm install dotenv
6. helmet: This middleware helps secure your Express apps by setting various HTTP headers.
Code:
bash
npm install helmet
These are some commonly used npm packages when building an Express application. You can install them by running the provided npm install commands in your project directory.