I have a node.js http application and i'm servicing GET requests ok. I can't however respond properly with requests for say foo.js?_param=1234. How do i deal correctly with files of this type where parameters are being passed?
EDIT:
I'm using express to service files as follows:
app.get('/*', function(req, res) {
res.sendfile(__application+req.url, {root: __root});
});
__root is the root path of the application.
Use request.url
, it will look like /foo.js?_param=123
.
Then use require('url').parse(url,true)
to split this into meaningful parts (true
is to also expand individual query string parameters).
See http://nodejs.org/api/http.html#http_request_url for details.