Spaces:
Sleeping
Sleeping
File size: 644 Bytes
3d97d52 5979e6b 3d97d52 5979e6b 3d97d52 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
import express, { type Express } from "express";
import { createResponseParamsSchema } from "./schemas.js";
import { validateBody } from "./middleware/validation.js";
import { requestLogger } from "./middleware/logging.js";
import { getLandingPageHtml, postCreateResponse, getHealth } from "./routes/index.js";
export const createApp = (): Express => {
const app: Express = express();
// Middleware
app.use(requestLogger());
app.use(express.json());
// Routes
app.get("/", getLandingPageHtml);
app.get("/health", getHealth);
app.post("/v1/responses", validateBody(createResponseParamsSchema), postCreateResponse);
return app;
};
|