fork of hey-api/openapi-ts because I need some additional things
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(
14 readFileSync(specificationPath, 'utf-8'),
15 );
16
17 fastify.register(glue, {
18 prefix: 'v3',
19 serviceHandlers,
20 specification: specificationJson,
21 });
22
23 return fastify;
24};