← back to Wallpaperglossary
server.js
21 lines
const express = require('express');
const path = require('path');
const app = express();
const PORT = process.env.PORT || 9902;
// Block snapshot/backup files from ever serving out of the static root
app.use((req, res, next) => {
if (/\.(bak|pre-)/i.test(req.path)) return res.status(404).end();
next();
});
app.use(express.static(path.join(__dirname, 'public')));
app.get('/health', (req, res) => res.json({ status: 'ok', site: 'wallpaperglossary.com' }));
app.get('/', (req, res) => {
res.sendFile(path.join(__dirname, 'public', 'index.html'));
});
app.listen(PORT, () => console.log(`wallpaperglossary.com :${PORT}`));