question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

return http server from .start

See original GitHub issue

Hi,

I’m running some unit tests with yoga and I’d like to close the server programatically but the http server isn’t accessible, and express doesn’t offer .close(). Would you be open to a pr that adds the httpServer as a property? or is there a better way to achieve this result?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:7
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
DavidBabelcommented, Sep 23, 2018

Is there any other way to get the http instance thant start ? Because for my tests with supertest i don’t want to start my server explicitly.

1reaction
craigmulligancommented, Apr 30, 2018

@JorgeCeja,

The http instance is returned from the server.start() method and not the server constructor. So check that you are invoking the method on the http instance and not the graphql server instance.

const server = new GraphQLServer({ typeDefs, resolvers })
server.start()
server.close() // wont work
const server = new GraphQLServer({ typeDefs, resolvers })
const httpServer = server.start()
httpServer.close() // will work
Read more comments on GitHub >

github_iconTop Results From Across the Web

When does an HTTP server start returning data?
After a connection has been established between client and server, the client starts sending an HTTP request. This consists of a line that...
Read more >
HTTP servers — Python 3.11.1 documentation
This class is identical to HTTPServer but uses threads to handle requests by using the ThreadingMixIn . This is useful to handle web...
Read more >
How To Create a Web Server in Node.js with the HTTP ...
Step 1 — Creating a Basic HTTP Server. Let's start by creating a server that returns plain text to the user. This will...
Read more >
How do you set up a local testing server? - MDN Web Docs
Open your command prompt (Windows) / terminal (macOS/ Linux). To check if Python is installed, enter the following command: · This should return...
Read more >
HttpServer (Java HTTP Server )
Then, all open TCP connections are closed, the background thread created by start() exits, and the method returns. Once stopped, a HttpServer cannot...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found