September 2018
Intermediate to advanced
328 pages
9h 10m
English
The application is loaded in /src/index.js. The contents of this file are shown as follows:
const express = require('express');const bodyParser = require('body-parser');const loadAssets = require('./load-assets');const assignRoutes = require('./assign-routes');// If you preface the npm start command with PORT=[Your Port] on// macOS/Ubuntu or set PORT=[Your Port] on Windows, it will change the port// that the server is running on, so PORT=3001 will run the app on// port 3001:const PORT = process.env.PORT || 3000;const startApp = async () => { const app = express(); // Use body-parser for parsing JSON in the body of a request: app.use(bodyParser.urlencoded({ extended: true })); app.use(bodyParser.json()); // Instantiate ...Read now
Unlock full access