Configuring Express

To use Express, we will first install Express, then add and configure it in the server/express.js file. 

From the command line, run the following command to install the express module with the --save flag, so the package.json file is automatically updated:

npm install express --save

Once Express is installed, we can import it into the express.js file, configure as required, and make it available to the rest of the app.

mern-skeleton/server/express.js:

import express from 'express'const app = express()  /*... configure express ... */export default app

To handle HTTP requests and serve responses properly, we will use the following modules to configure Express:

  • body-parser: Body parsing middleware to handle the complexities ...

Get Full-Stack React Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.