Install Node.js if you haven't already (download from nodejs.org), then:
npx serve -l 3000
Create this as server.js
file
const http = require('http'); const fs = require('fs'); const path = require('path'); const port = 3000; // Change this to your preferred port const server = http.createServer((req, res) => { let filePath = '.' + req.url; if (filePath === './') filePath = './local-server.html'; fs.readFile(filePath, (err, content) => { if (err) { res.writeHead(404); res.end('File not found'); return; } res.writeHead(200); res.end(content); }); }); server.listen(port, () => { console.log(`Server running at http://localhost:${port}/`); });
Then run:
node server.js
Enter a port number (4000-9999 recommended):
Once running, open your browser to:
http://localhost:[PORT]