'How to set a timeout for client http connections in node.js

In my node.js application I need my app to communicate to a server. I made an http connection. I can't find an option in the node.js documentation for setting a timeout on the connection, and it seems that default is 20 seconds. I'd like to increase the timeout to 1 minute for slow connections , Is there a way to do that in node.js?



Sources

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

Source: Stack Overflow

Solution Source