Using match engine of node.js express module independent of app.server()

In express 3.0, I am trying to use express for only routing purposes, rather than using it coupled with app.server(). The idea is to use routing engine, but as part of another framework in which I want to allocate URL spaces to different sub modules. Ideally I should support existing routing engines, so folks can repurpose their existing codebase easily.

Since express seems quite a bit coupled with assumptions about req and res, I am trying to find out the subset of both that express depends, so I get no errors. And then redefine res.render() etc. to suite my tastes.

For this code: var app=require('express')(); // Register routes... app.get( '/test', function(req, res){ console.log("In test1."); });

// From: http://nodejs.org/api/http.html#http_class_http_serverrequest
var req1={ headers: {}, method: 'GET', url: "/test" };
var req2={ headers: {}, method: 'GET', url: "/no_match" };
var res={
  setHeader: function(a, b) {console.log(a, b);}
};
console.log("About to test routing now.");
app(req1, res); // ok, should call associated method.
app(req2, res); // Errors!

The first app() returns fine. But the second one gives series of errors. Express should necessarily depend on req, and that is required. But I am not able to understand why should it depend on response object, since response is used only by methods of application. What subset of res object should I create, so I can be assured that it works for any random code that users may be using for their app?