35 lines
701 B
TypeScript
35 lines
701 B
TypeScript
import { apiReference } from "@scalar/express-api-reference";
|
|
import type { Express, Response } from "express";
|
|
import { openApiSpec } from "../scaler/config.js";
|
|
|
|
export const setupRoutes = (app: Express) => {
|
|
/**
|
|
* @openapi
|
|
* /:
|
|
* get:
|
|
* summary: Health check
|
|
* responses:
|
|
* 200:
|
|
* description: Success
|
|
*/
|
|
app.get("/", (_, res: Response) => {
|
|
res.status(200).json({
|
|
success: true,
|
|
message: "This is just an example of this working",
|
|
});
|
|
});
|
|
|
|
app.get("/api/docs.json", (_, res) => {
|
|
res.json(openApiSpec);
|
|
});
|
|
|
|
app.use(
|
|
"/api/dos",
|
|
apiReference({
|
|
// Put your OpenAPI url here:
|
|
url: "/openapi.json",
|
|
theme: "purple",
|
|
}),
|
|
);
|
|
};
|