Starting the server

With the Express app configured to accept HTTP requests, we can go ahead and use it to implement the server to listen for incoming requests.

In the mern-skeleton/server/server.js file, add the following code to implement the server:

import config from './../config/config'import app from './express'app.listen(config.port, (err) => {  if (err) {    console.log(err)  }  console.info('Server started on port %s.', config.port)})

We first import the config variables to set the port number that the server will listen on, and then the configured Express app to start the server.

To get this code running and continue development, you can now run npm run development from the command line. If the code has no errors, the server should start ...

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.