From fb593cc592c5af116c10717daf3e0ec818b251d4 Mon Sep 17 00:00:00 2001 From: pancakes-proxy Date: Sat, 10 May 2025 04:23:51 +0900 Subject: [PATCH] Initialize web server with Express for serving static files --- website/app.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 website/app.js diff --git a/website/app.js b/website/app.js new file mode 100644 index 0000000..de15fa7 --- /dev/null +++ b/website/app.js @@ -0,0 +1,17 @@ +const express = require('express'); +const path = require('path'); +const app = express(); +const port = 443; // Port 443 is typically used for HTTPS, may require elevated privileges + +// Serve static files from the 'website' directory +app.use(express.static(path.join(__dirname, '/'))); + +// Catch-all route to serve index.html for any other requests +app.get('*', (req, res) => { + res.sendFile(path.join(__dirname, 'index.html')); +}); + +app.listen(port, () => { + console.log(`Web server listening on port ${port}`); + console.log(`Serving files from: ${__dirname}`); +});