Spaces:
Sleeping
Sleeping
Download backend/src/app.ts from bardd/mike-backend: direct link, hf CLI and curl.
- Browser
- Download file 1.99 kB
-
https://huggingface.co/spaces/bardd/mike-backend/resolve/main/backend/src/app.ts
- Command line
-
hf download hf://spaces/bardd/mike-backend/backend/src/app.ts
-
curl -L -o app.ts https://huggingface.co/spaces/bardd/mike-backend/resolve/main/backend/src/app.ts
1.99 kB
| import express, { type Express } from "express"; | |
| import cors from "cors"; | |
| import { chatRouter } from "./routes/chat"; | |
| import { projectsRouter } from "./routes/projects"; | |
| import { projectChatRouter } from "./routes/projectChat"; | |
| import { documentsRouter } from "./routes/documents"; | |
| import { tabularRouter } from "./routes/tabular"; | |
| import { workflowsRouter } from "./routes/workflows"; | |
| import { userRouter } from "./routes/user"; | |
| import { downloadsRouter } from "./routes/downloads"; | |
| import { playbooksRouter } from "./routes/playbooks"; | |
| import { playbookReviewRouter } from "./routes/playbookReview"; | |
| import { commentThreadsRouter } from "./routes/commentThreads"; | |
| import { notificationsRouter } from "./routes/notifications"; | |
| import { localAuthRouter } from "./routes/localAuth"; | |
| export type AuthIdentity = { | |
| id: string; | |
| email: string; | |
| }; | |
| export type AuthVerifier = (token: string) => Promise<AuthIdentity | null>; | |
| type CreateAppOptions = { | |
| authVerifier?: AuthVerifier; | |
| }; | |
| export function createApp(options: CreateAppOptions = {}): Express { | |
| const app = express(); | |
| app.locals.authVerifier = options.authVerifier; | |
| app.use( | |
| cors({ | |
| origin: process.env.FRONTEND_URL ?? "http://localhost:3000", | |
| credentials: true, | |
| }), | |
| ); | |
| app.use(express.json({ limit: "50mb" })); | |
| app.use("/auth", localAuthRouter); | |
| app.use("/chat", chatRouter); | |
| app.use("/projects", projectsRouter); | |
| app.use("/projects/:projectId/chat", projectChatRouter); | |
| app.use("/single-documents", documentsRouter); | |
| app.use("/tabular-review", tabularRouter); | |
| app.use("/workflows", workflowsRouter); | |
| app.use("/user", userRouter); | |
| app.use("/users", userRouter); | |
| app.use("/download", downloadsRouter); | |
| app.use("/playbooks", playbooksRouter); | |
| app.use("/playbook-review", playbookReviewRouter); | |
| app.use("/comment-threads", commentThreadsRouter); | |
| app.use("/notifications", notificationsRouter); | |
| app.get("/health", (_req, res) => res.json({ ok: true })); | |
| return app; | |
| } | |