Spaces:
Running
Running
File size: 600 Bytes
3d97d52 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
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 } 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.post("/v1/responses", validateBody(createResponseParamsSchema), postCreateResponse);
return app;
};
|