Closed yuluyi closed 6 years ago
If I understand correctly, you would like a Moleculer-Nest sidecar in order to call Nest API from Moleculer services via broker.call
?
@icebob NestJS already provides a ExecutionContext selector. You can select and call whatever service or controller inside the nest web app. If we directly wire broker.call to the service or controller, the http request is not provided, so all the middlewares and auth guards will not work.
I prefer the aws-serverless-express approach. It creates the web app but doesn't listen to any port. It rebuilds the http request from lambda event, and then sends the request directly to web app through the socket.
If you create an example repo which contains a simple moleculer project and a simple Nest web app, I will try to do something.
Never mind. I just found I can use traefik to proxy the request directly to nest web app. Or I can use broker.call and directly call the controller or services inside my web app if I don't care about the http context. Using both can cover all my use cases.
I'll close the issue.
Is your feature request related to a problem? Please describe.
Use case:
I have a web app built on NestJS. Its http server is based on Express. I want to integrate this web app into moleculer. There are two solutions:
Describe the solution you'd like
I prefer solution 2 because it is cleaner. It allows other service to call this service directly rather than taking a detour to send the http request to the api gateway. Also, solution 2 provides possibilities that we can migrate the original web app to moleculer service structure little by little.
But I can't find a way to build http request from moleculer ctx.
Describe alternatives you've considered
Additional context