mirror of
https://gitlab.com/pancakes1234/wdiscordbotserver.git
synced 2025-06-15 23:04:20 -06:00
Initialize web server with Express for serving static files
This commit is contained in:
parent
35c40ea195
commit
fb593cc592
17
website/app.js
Normal file
17
website/app.js
Normal file
@ -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}`);
|
||||
});
|
Loading…
x
Reference in New Issue
Block a user