Spaces:
Sleeping
Sleeping
Download server/static.ts from QuarterZip/AI_Manager_Dashboard: direct link, hf CLI and curl.
- Browser
- Download file 547 Bytes
-
https://huggingface.co/spaces/QuarterZip/AI_Manager_Dashboard/resolve/main/server/static.ts
- Command line
-
hf download hf://spaces/QuarterZip/AI_Manager_Dashboard/server/static.ts
-
curl -L -o static.ts https://huggingface.co/spaces/QuarterZip/AI_Manager_Dashboard/resolve/main/server/static.ts
547 Bytes
| import express, { type Express } from "express"; | |
| import fs from "fs"; | |
| import path from "path"; | |
| export function serveStatic(app: Express) { | |
| const distPath = path.resolve(__dirname, "public"); | |
| if (!fs.existsSync(distPath)) { | |
| throw new Error( | |
| `Could not find the build directory: ${distPath}, make sure to build the client first`, | |
| ); | |
| } | |
| app.use(express.static(distPath)); | |
| // fall through to index.html if the file doesn't exist | |
| app.use("*", (_req, res) => { | |
| res.sendFile(path.resolve(distPath, "index.html")); | |
| }); | |
| } | |