MCPcopy Create free account
hub / github.com/Writesonic/GPTRouter / initSwagger

Function initSwagger

src/swagger.ts:8–37  ·  view source on GitHub ↗
(server: FastifyInstance)

Source from the content-addressed store, hash-verified

6 * @returns {Promise<void>} - A Promise that resolves once Swagger is successfully initialized
7 */
8export default async function initSwagger(server: FastifyInstance) {
9 // eslint-disable-next-line @typescript-eslint/no-var-requires
10 await server.register(require("@fastify/swagger"), {
11 openapi: {
12 info: {
13 title: "Test swagger",
14 description: "testing the fastify swagger api",
15 version: "0.1.0",
16 },
17 servers: [
18 {
19 url: "http://localhost:8000",
20 },
21 ],
22 components: {
23 securitySchemes: {
24 apiKey: {
25 type: "apiKey",
26 name: "apiKey",
27 in: "header",
28 },
29 },
30 },
31 },
32 });
33 // eslint-disable-next-line @typescript-eslint/no-var-requires
34 await server.register(require("@fastify/swagger-ui"), {
35 routePrefix: "/docs",
36 });
37}

Callers 1

buildServerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected