April 2020
Intermediate to advanced
716 pages
18h 55m
English
With the Express app configured to accept HTTP requests, we can go ahead and use it to implement a server that can 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)})
First, we import the config variables to set the port number that the server will listen on and then import the configured Express app to start the server. To get this code running and continue development, we can run yarn development from the command line. If the code has no errors, the server should ...