33 lines
849 B
TypeScript
33 lines
849 B
TypeScript
import { FastifyInstance } from "fastify";
|
|
import fastifySwagger from "@fastify/swagger";
|
|
import fastifySwaggerUi from "@fastify/swagger-ui";
|
|
|
|
export async function registerSwagger(fastify: FastifyInstance) {
|
|
await fastify.register(fastifySwagger, {
|
|
openapi: {
|
|
info: {
|
|
title: "API Docs",
|
|
description: "API documentation for Fastify server",
|
|
version: "1.0.0"
|
|
},
|
|
servers: [
|
|
{
|
|
url: "http://localhost:3000",
|
|
description: "Local Development",
|
|
},
|
|
{
|
|
url: "https://api.scheduler.bkdhome.p-e.kr",
|
|
description: "Production Server"
|
|
}
|
|
]
|
|
}
|
|
});
|
|
|
|
await fastify.register(fastifySwaggerUi, {
|
|
routePrefix: "/docs",
|
|
uiConfig: {
|
|
docExpansion: "none",
|
|
deepLinking: false
|
|
}
|
|
});
|
|
} |