If you're new to Node/Express, it's important to familiarize yourself with how Express operates before integrating it into a live app.
Let me clarify: You likely have a set of HTML files that you wish to display to users using specific file names like example.com/about.html, with the main homepage file named index.html so that Express knows where to display each file.
This is a straightforward approach to achieving the desired outcome.
const express = require('express');
const app = express();
const path = require('path');
// Specify the port the application will run on
// Use the server's environment variable PORT if available; otherwise, default to port 5000
const PORT = process.env.PORT || 5000;
// Use Express middleware for serving static files
// Define paths to static files using path.join()
app.use(express.static(path.join(__dirname, "structures")));
// Apply middleware for styles under "/styles" URI
app.use("/styles", express.static(path.join(__dirname, "styles")));
// Start the server on the specified PORT
app.listen(PORT);