Is there a way to initiate an internal request in express without the full process of a real request? Here's an example to illustrate the idea:
app.get("/pages/:page", funciton(req, res)
{
database_get(req.params.page, function(result)
{
// This route requires fetching additional data through another request:
request(result.user_href, function(user_response)
{
result.user = user.response.json;
res.send(result);
});
});
});
/// ....
app.get("/user/:name", function() ... );
Essentially, I'm looking for a simpler way to access this data without duplicating routes and having to rebuild logic. Any suggestions on how to achieve this more efficiently?