-
-
Notifications
You must be signed in to change notification settings - Fork 98
Expand file tree
/
Copy pathdashboard-server.js
More file actions
34 lines (27 loc) · 1.03 KB
/
Copy pathdashboard-server.js
File metadata and controls
34 lines (27 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Copyright (c) 2024-2026 nich (@nichxbt). Licensed under the Apache License, Version 2.0.
/**
* Standalone static server for the dashboard (no database, no API).
*
* Usage: node dashboard-server.js (PORT overrides the default 3000)
* For the full app with the REST API behind it, run `node api/server.js` instead.
*/
import express from 'express';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const DASHBOARD_DIR = path.join(__dirname, 'dashboard');
const app = express();
app.use(express.static(DASHBOARD_DIR));
app.get('/', (req, res) => {
res.sendFile(path.join(DASHBOARD_DIR, 'login.html'));
});
app.get('/dashboard', (req, res) => {
res.sendFile(path.join(DASHBOARD_DIR, 'index.html'));
});
app.get('/pricing', (req, res) => {
res.sendFile(path.join(DASHBOARD_DIR, 'pricing.html'));
});
const PORT = Number(process.env.PORT) || 3000;
app.listen(PORT, () => {
console.log(`🎨 Dashboard running at http://localhost:${PORT}`);
});