mirror of
https://github.com/blackboxprogramming/BlackRoad-Operating-System.git
synced 2026-03-17 06:57:17 -05:00
45 lines
1.1 KiB
JavaScript
45 lines
1.1 KiB
JavaScript
import express from 'express';
|
|
import path from 'path';
|
|
import { fileURLToPath } from 'url';
|
|
import express from "express";
|
|
import path from "path";
|
|
import { fileURLToPath } from "url";
|
|
|
|
const __filename = fileURLToPath(import.meta.url);
|
|
const __dirname = path.dirname(__filename);
|
|
|
|
const app = express();
|
|
const port = process.env.PORT || 8080;
|
|
|
|
app.get('/health', (_req, res) => {
|
|
res.json({ status: 'ok' });
|
|
});
|
|
|
|
app.use(express.static(path.join(__dirname, 'public')));
|
|
|
|
app.get('*', (_req, res) => {
|
|
res.sendFile(path.join(__dirname, 'public', 'index.html'));
|
|
});
|
|
|
|
app.listen(port, () => {
|
|
console.log(`BlackRoad OS placeholder server listening on port ${port}`);
|
|
const PORT = process.env.PORT || 8080;
|
|
|
|
app.use(express.static(path.join(__dirname, "public")));
|
|
|
|
app.get("/health", (_req, res) => {
|
|
res.json({
|
|
ok: true,
|
|
service: "blackroad-operating-system",
|
|
status: "healthy"
|
|
});
|
|
});
|
|
|
|
app.get("*", (_req, res) => {
|
|
res.sendFile(path.join(__dirname, "public", "index.html"));
|
|
});
|
|
|
|
app.listen(PORT, () => {
|
|
console.log(`BlackRoad OS app listening on port ${PORT}`);
|
|
});
|