Spaces:
Configuration error
Configuration error
Download src/dashboard/server.js from UUUZCX/video-optimizer-bot: direct link, hf CLI and curl.
- Browser
- Download file 724 Bytes
-
https://huggingface.co/spaces/UUUZCX/video-optimizer-bot/resolve/main/src/dashboard/server.js
- Command line
-
hf download hf://spaces/UUUZCX/video-optimizer-bot/src/dashboard/server.js
-
curl -L -o server.js https://huggingface.co/spaces/UUUZCX/video-optimizer-bot/resolve/main/src/dashboard/server.js
724 Bytes
| const express = require("express"); | |
| const path = require("node:path"); | |
| const { paths } = require("../config/paths"); | |
| const { snapshot } = require("../monitoring/metrics"); | |
| const { listJobs, listEvents } = require("../queue/jobs"); | |
| function createDashboardServer() { | |
| const app = express(); | |
| app.use(express.static(paths.dashboardPublic)); | |
| app.get("/api/status", async (_req, res) => res.json(await snapshot())); | |
| app.get("/api/queue", (_req, res) => res.json({ jobs: listJobs(100) })); | |
| app.get("/api/logs", (_req, res) => res.json({ events: listEvents(200) })); | |
| app.get("*", (_req, res) => res.sendFile(path.join(paths.dashboardPublic, "index.html"))); | |
| return app; | |
| } | |
| module.exports = { createDashboardServer }; | |