|
- import fastify, {FastifyServerOptions} from 'fastify';
- import * as codeCore from '@modal/code-core';
- import {fastifyErrorHandler} from './packages/fastify-compliant-http-errors';
- import fastifySendData from './packages/fastify-send-data';
-
- declare module 'fastify' {
- interface FastifyRequest {
- user?: codeCore.common.User,
- }
- }
-
- export const createServer = (opts?: FastifyServerOptions) => {
- const server = fastify(opts)
-
- server.setErrorHandler(fastifyErrorHandler)
-
- server.register(fastifySendData)
-
- return server;
- }
|