diff --git a/get-started/single-page-app/website.md b/get-started/single-page-app/website.md index 3066216..a909513 100644 --- a/get-started/single-page-app/website.md +++ b/get-started/single-page-app/website.md @@ -99,16 +99,18 @@ Now create a `server.js` file in the root folder of your project. Add the follow ```javascript const express = require("express"); const { join } = require("path"); +const path = require("path"); const app = express(); // Serve static assets from the /public folder app.use(express.static(join(__dirname, "public"))); // Serve the index page for all other requests -app.get("/*", (_, res) => { - res.sendFile(join(__dirname, "index.html")); +app.get(/.*/, (req, res) => { + res.sendFile(path.join(__dirname, "index.html")); }); + // Listen on port 3000 app.listen(3000, () => console.log("Application running on port 3000")); ```