This may seem like a stupid question but is it possible to establish a connection between a webserver and a nodejs application? I know that I can make requests from the nodejs server but is it possible to do something the other way around?
Assuming the webserver in question allows you to make outgoing network connections, you just use whatever features it has for doing so to connect to your node.js server and make a request, whether an HTTP request or some generic TCP request. For example, if the webserver were running PHP, you'd probably use the cURL
PHP module to make an HTTP connection, or fsockopen()
along with fread()
and fwrite()
for a raw TCP connection.
Note that some hosting arrangements may disallow outgoing connections.
You can use the request-library to do a HTTP request to another node.js server.