| Deliver HTML at specified path Here's how to create an Express server and serve index.html by default (empty path /), and page1.html for /page1 path. Folder structure server.js Note that sendFile() just streams a static file as response, offering no opportunity to modify it. If you are serving an HTML file and want to include dynamic data with it, then you will need to use a template engine such as Pug, Mustache, or EJS. Syntax - response.sendFile(fileName, options, function (err) {});
|