Spaces:
Running
Running
| import cors from "cors"; | |
| import express from "express"; | |
| import helmet from "helmet"; | |
| import morgan from "morgan"; | |
| import { healthRouter } from "./routes/health"; | |
| import { matchesRouter } from "./routes/matches"; | |
| import { messagesRouter } from "./routes/messages"; | |
| import { openClawRouter } from "./routes/openClaw"; | |
| import { paymentWebhookRouter, paymentsRouter } from "./routes/payments"; | |
| import { profilesRouter } from "./routes/profiles"; | |
| import { errorHandler, notFoundHandler } from "./middleware/errors"; | |
| export function createApp() { | |
| const app = express(); | |
| app.use(helmet()); | |
| app.use(cors()); | |
| app.use(morgan("tiny")); | |
| app.use("/api/payments/webhook", express.raw({ type: "application/json" }), paymentWebhookRouter); | |
| app.use(express.json({ limit: "1mb" })); | |
| app.use("/health", healthRouter); | |
| app.use("/api/openclaw", openClawRouter); | |
| app.use("/api/profiles", profilesRouter); | |
| app.use("/api/payments", paymentsRouter); | |
| app.use("/api/matches", matchesRouter); | |
| app.use("/api/messages", messagesRouter); | |
| app.use(notFoundHandler); | |
| app.use(errorHandler); | |
| return app; | |
| } | |