How to use the fastify.default function in fastify

To help you get started, we’ve selected a few fastify examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ChainSafe / lodestar / packages / lodestar / src / api / rest / index.ts View on Github external
private  setupServer(modules: IApiModules): IFastifyServer {
    const server = fastify.default({
      //TODO: somehow pass winston here
      logger: false,
      querystringParser: qs.parse
    }) as IFastifyServer;

    if(this.opts.cors) {
      const corsArr = this.opts.cors.split(",");
      server.register(fastifyCors, {
        origin: corsArr
      });
    }

    if(this.opts.api.includes(ApiNamespace.BEACON)) {
      //@ts-ignore
      server.register(routes.beacon, {prefix: "/node", modules});
    }

fastify

Fast and low overhead web framework, for Node.js

MIT
Latest version published 28 days ago

Package Health Score

97 / 100
Full package analysis