is there a way to respond to a GET\POST outside of the specific (req, res) function?

using Express (NodeJS), is there a way to save the details of a request so that the response will be done in a later time? (basically, leaving the request hangin for the response). without using setTimeout() or sleep or any other delay.

for example if this is my function:

function(req, res) {
    var data = req.body;
    setTimeout(function() {
        res.json(data);
    }, 3000);
}

is it possible to use (req, res) objects outside that function scope AND succesfuly respond to a specific request on later time? (for example 30 seconds afterwards, or in a differenr part of the code)

No I don't think so. The request/response are specific to the handler call.

Yes, this is possible. All you need to do is call a long-running non-async (blocking) function prior to calling res.json() or any other function that sends a response, e.g.

function(req, res) {
    var data = longRunningNonAsyncFsCall();
    res.jsonp(data);
}

I don't think setTimeout() is what you need.