UNPKG

@h4ad/serverless-adapter

Version:

Run REST APIs and other web applications using your existing Node.js application framework (NestJS, Express, Koa, Hapi, Fastify and many others), on top of AWS, Azure, Digital Ocean and many other clouds.

1 lines 1.1 kB
{"version":3,"sources":["../../../src/frameworks/fastify/fastify.framework.ts"],"sourcesContent":["//#region Imports\n\nimport type { IncomingMessage, ServerResponse } from 'http';\nimport type { FastifyInstance } from 'fastify';\nimport type { FrameworkContract } from '../../contracts';\n\n//#endregion\n\n/**\n * The framework that forwards requests to fastify handler\n *\n * @breadcrumb Frameworks / FastifyFramework\n * @public\n */\nexport class FastifyFramework implements FrameworkContract<FastifyInstance> {\n /**\n * {@inheritDoc}\n */\n public sendRequest(\n app: FastifyInstance,\n request: IncomingMessage,\n response: ServerResponse,\n ): void {\n // ref: https://www.fastify.io/docs/latest/Guides/Serverless/#implement-and-export-the-function\n app.ready().then(() => app.server.emit('request', request, response));\n }\n}\n"],"mappings":"6CAcO,IAAMA,EAAN,KAAqE,CAd5E,MAc4E,CAAAC,EAAA,yBAInE,YACLC,EACAC,EACAC,EACM,CAENF,EAAI,MAAM,EAAE,KAAK,IAAMA,EAAI,OAAO,KAAK,UAAWC,EAASC,CAAQ,CAAC,CACtE,CACF","names":["FastifyFramework","__name","app","request","response"]}