build stuff
This commit is contained in:
@@ -1,10 +1,34 @@
|
||||
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",
|
||||
}),
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user