responses.js / src /server.ts
Wauplin's picture
Wauplin HF Staff
Upload folder using huggingface_hub
3d97d52 verified
raw
history blame contribute delete
600 Bytes
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;
};