Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible to use with NestJS ? #18

Open
Suedo opened this issue Jun 14, 2020 · 2 comments
Open

Possible to use with NestJS ? #18

Suedo opened this issue Jun 14, 2020 · 2 comments

Comments

@Suedo
Copy link

Suedo commented Jun 14, 2020

Since NestJS is a framework built on express, and this project uses aws-serverless-express which is supposed to work with any express framework, I was hoping there would be a way to use this plugin for NestJS projects.

Any ideas ?

@germangamboa95
Copy link
Contributor

You should be able to as express is a valid HTTP transport for nest js. See #12 as to how you would make it work with TS.

@attilagyongyosi
Copy link

I am currently in the same situation and I must state, this will not be an answer for you, unfortunately.

Judging from the current state of the Express component for Serverless, there is an inherent "clash" between the asynchronous nature of bootstrapping a NestJS application instance and the synchronous handler code implemented within the Express component.

In essence, for the Express Component to work, you need to export your Express application instance from your app.js. The Express Component Lambda handler will require() your app.js (hence get your Express application instance) and handle the incoming Lambda event.
In a NestJS environment though, you would need to create your Nest application first, which is an asynchronous operation through NestFactory.create().

Although it should not be really difficult to create a custom component for Express-backed NestJS based off of the Express one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants