Web API for code.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

21 lines
533 B

  1. import fastify, {FastifyServerOptions} from 'fastify';
  2. import * as codeCore from '@modal/code-core';
  3. import {fastifyErrorHandler} from './packages/fastify-compliant-http-errors';
  4. import fastifySendData from './packages/fastify-send-data';
  5. declare module 'fastify' {
  6. interface FastifyRequest {
  7. user?: codeCore.common.User,
  8. }
  9. }
  10. export const createServer = (opts?: FastifyServerOptions) => {
  11. const server = fastify(opts)
  12. server.setErrorHandler(fastifyErrorHandler)
  13. server.register(fastifySendData)
  14. return server;
  15. }