request: expose httpServer to app context
See original GitHub issueI’m submitting a…
[ ] Regression
[ ] Bug report
[x] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.
I want to be able to access the httpServer from the application context. Specifically, in my case I want to simply register a graphql subscriptions server (I saw the example, but it’s too complicated and creates a new server instead of reusing the existing one)
class MyModule implements NestModule {
// ...
configure(consumer: MiddlewaresConsumer) {
// get schema
new SubscriptionServer({
execute,
subscribe,
schema
}, {
// server: appHttpServer, // ?? how do I get reference to the app server?
path: '/subscriptions',
});
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:8 (4 by maintainers)
Top Results From Across the Web
HTTP servers — Python 3.11.1 documentation
This class is used to handle the HTTP requests that arrive at the server. By itself, it cannot respond to any actual HTTP...
Read more >Simple HTTP server in Java using only Java SE API
Umm...the short answer is no. If you want something that handles post and get requests without manually writing the http headers then you...
Read more >How To Make an HTTP Server in Go
In this section, you'll start by using the function http.HandleFunc to tell the server which function to call to handle a request to...
Read more >API Reference: ApolloServer - Apollo GraphQL Docs
This article documents the ApolloServer class from the @apollo/server package. You can use the ApolloServer class to create an instance of Apollo Server ......
Read more >Execution context | NestJS - A progressive Node.js ...
... Nest HTTP server-based, microservices and WebSockets application contexts). ... of the box by the framework and exposed from the @nestjs/core package.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You can inject HTTP server reference using
HTTP_SERVER_REF
token. The reference is an HTTP adapter currently used by the application. Each adapter implementsHttpServer
interface:The
HTTP_SERVER_REF
is exported from@nestjs/core
whileHttpServer
interface from@nestjs/common
. Also, this instance exposesgetHttpServer()
method that allows picking up the underlying object (express instance by default).@blissi try
this.httpServerRef.getHttpServer()