Hello all, just joined; express is great. Question:
Is it possible to manually create a request object and then run it
through express, without having an actual http request come from the
browser?
Use case: I'm working on a web socket library built on
socket.io that
can take requests for a certain url and return the html that it would
render, had the browser requested the uri via regular http. Basically
take regular http requests out of the picture and run all page
requests through web sockets...after the initial load. Of course, if
the browser DOES do an http request for the url, the server needs to
respond normally (standard expressjs usage).
So on the server, I need to setup
socket.io to handle messages and
respond with the correct response. In the interest of keeping
everything DRY, I need to use the already defined express routes to
handle the request. I found app.handle(req, res), and have tried to
create new request and response objects to pass in, but have so far
been unsuccessful in using it.
Any thoughts?