'How would you time out a graphQL query

Looking around in documentation relating to graphQL. I have not been able to find out how to time out a query that is taking a long time to return a response.

The server can be started with :

server.listen(4000, '0.0.0.0') => { console.log(Server ready); });

Any help would be appreciated.



Solution 1:[1]

You can set the timeout by adding:

server.listen(4000, '0.0.0.0') => { console.log(Server ready); })
.then(s => s.setTimeout(<your timeout in millis>));;


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Kn3cht