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.

2 lines 847 B
import{r as p}from"../../chunk-6BLWJRLG.mjs";import{a as o}from"../../chunk-QWPVIX2T.mjs";var c=class{constructor(a,e,r=p()){this.framework=a;this.factory=e;this.logger=r;this.delayedFactory=Promise.resolve().then(()=>e()).then(t=>{this.cachedApp=t}).catch(t=>{this.logger.error("SERVERLESS_ADAPTER:LAZY_FRAMEWORK: An error occours during the creation of your app."),this.logger.error(t)})}static{o(this,"LazyFramework")}cachedApp;delayedFactory;sendRequest(a,e,r){if(this.cachedApp)return this.framework.sendRequest(this.cachedApp,e,r);this.delayedFactory.then(()=>this.cachedApp?this.framework.sendRequest(this.cachedApp,e,r):r.emit("error",new Error("SERVERLESS_ADAPTER:LAZY_FRAMEWORK: The instance of the app returned by the factory is not valid, see the logs to learn more.")))}};export{c as LazyFramework}; //# sourceMappingURL=index.mjs.map