File size: 1,314 Bytes
cf9339a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
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);