fork of hey-api/openapi-ts because I need some additional things
at feat/skip-token 22 lines 548 B view raw
1import { readFileSync } from 'node:fs'; 2import { join } from 'node:path'; 3 4import Fastify from 'fastify'; 5import glue from 'fastify-openapi-glue'; 6 7import { serviceHandlers } from './handlers'; 8 9export const buildServer = async () => { 10 const fastify = Fastify(); 11 12 const specificationPath = join(__dirname, '..', 'openapi.json'); 13 const specificationJson = JSON.parse(readFileSync(specificationPath, 'utf-8')); 14 15 fastify.register(glue, { 16 prefix: 'v3', 17 serviceHandlers, 18 specification: specificationJson, 19 }); 20 21 return fastify; 22};