May 2018
Intermediate to advanced
470 pages
13h 54m
English
Webpack will compile client-side code in both development and production mode, then place the bundled files in the dist folder. To make these static files available on requests from the client side, we will add the following code in server.js to serve static files from dist/folder.
mern-simplesetup/server/server.js:
import path from 'path'const CURRENT_WORKING_DIR = process.cwd()app.use('/dist', express.static(path.join(CURRENT_WORKING_DIR, 'dist')))
Read now
Unlock full access