Add Express static server

This commit is contained in:
2026-09-24 09:57:52 +02:00
commit 71346f341f
+36
View File
@@ -0,0 +1,36 @@
// Digital Spaceport Arcade — static server
// Pure JS. Serves ./public on 0.0.0.0:8099
const express = require('express');
const path = require('path');
const app = express();
const PORT = process.env.PORT || 8099;
const HOST = process.env.HOST || '0.0.0.0';
app.use(express.static(path.join(__dirname, 'public'), {
extensions: ['html'],
setHeaders(res, filePath) {
if (filePath.endsWith('.html')) {
res.setHeader('Cache-Control', 'no-cache');
}
}
}));
// Favicon: inline SVG (retro pixel heart)
app.get('/favicon.ico', (req, res) => {
res.type('image/svg+xml').send(
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">'
+ '<rect x="2" y="3" width="4" height="3" fill="#ff2d95"/>'
+ '<rect x="10" y="3" width="4" height="3" fill="#ff2d95"/>'
+ '<rect x="2" y="6" width="12" height="3" fill="#ff2d95"/>'
+ '<rect x="4" y="9" width="8" height="2" fill="#ff2d95"/>'
+ '<rect x="6" y="11" width="4" height="2" fill="#ff2d95"/>'
+ '</svg>'
);
});
app.get('/healthz', (req, res) => res.json({ ok: true, name: 'digital-spaceport-arcade' }));
app.listen(PORT, HOST, () => {
console.log(`[dsp-arcade] serving on http://${HOST}:${PORT}`);
});