MCPcopy Create free account
hub / github.com/F12FLASH/CTF / serveStatic

Function serveStatic

4.Stackless Stack/server/vite.ts:70–85  ·  view source on GitHub ↗
(app: Express)

Source from the content-addressed store, hash-verified

68}
69
70export function serveStatic(app: Express) {
71 const distPath = path.resolve(import.meta.dirname, "public");
72
73 if (!fs.existsSync(distPath)) {
74 throw new Error(
75 `Could not find the build directory: ${distPath}, make sure to build the client first`,
76 );
77 }
78
79 app.use(express.static(distPath));
80
81 // fall through to index.html if the file doesn't exist
82 app.use("*", (_req, res) => {
83 res.sendFile(path.resolve(distPath, "index.html"));
84 });
85}

Callers 1

index.tsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected