Spaces:
Paused
Paused
| const fs = require('fs'); | |
| const content = fs.readFileSync('server/src/app.ts', 'utf8'); | |
| const search = ` app.use(llmRoutes(db)); | |
| // Mount API routes | |
| const api = Router(); | |
| api.use(boardMutationGuard()); | |
| api.use( | |
| "/health",`; | |
| const replace = ` app.use(llmRoutes(db)); | |
| app.get("/health", (_req, res) => { | |
| res.status(200).json({ status: "ok" }); | |
| }); | |
| app.get("/api-docs", (_req, res) => { | |
| res.status(200).json({ | |
| endpoints: [ | |
| { | |
| path: "/api/health", | |
| method: "GET", | |
| purpose: "Returns API health status", | |
| request: null, | |
| response: { status: "ok" } | |
| }, | |
| { | |
| path: "/api/companies", | |
| method: "GET", | |
| purpose: "Lists all companies", | |
| request: null, | |
| response: [{ id: "string", name: "string" }] | |
| }, | |
| { | |
| path: "/api/companies", | |
| method: "POST", | |
| purpose: "Creates a new company", | |
| request: { name: "string", goal: "string" }, | |
| response: { id: "string", name: "string" } | |
| } | |
| ] | |
| }); | |
| }); | |
| // Mount API routes | |
| const api = Router(); | |
| api.use(boardMutationGuard()); | |
| api.use( | |
| "/health",`; | |
| const newContent = content.replace(search, replace); | |
| fs.writeFileSync('server/src/app.ts', newContent); | |