First, build a small ExpressJS server application whose sole purpose will be to serve an HTML file and the Redux module:
- Create a new file named meal-time-server.js
- Include the ExpressJS and path module and initialize a new ExpressJS Application:
const express = require('express') const path = require('path') const app = express()
- Serve the Redux library on /lib path. Make sure that the path points to the node_modules folder:
app.use('/lib', express.static( path.join(__dirname, 'node_modules', 'redux', 'dist') ))
- Serve the client application on the root path /:
app.get('/', (req, res) => { res.sendFile(path.join( __dirname, 'meal-time-client.html', )) })
- Listen for new connections on port 1337:
app.listen( 1337, ...