Q:

Failed to lookup view in node express for jade

I'm using Jade template engine to replace to replace my variables:; I have tried the following:
var express = require('express');
var jade = require('jade');
var router = express.Router();
router.get('/test', function (req, res, next) {
        var html= res.render(jade.renderFile('test', {"message": "test1", "title": "test2"}));
        res.render(html);
});
module.exports = router;

and the following is my test.jade:
html
  head
    title= title
  body
    h1= message

But I keep the folowing error: 
message: 
> "Failed to lookup view
> "<html><head><title>test2</title></head><body><h1>test1</h1></body></html>"
> in views directory "C:\node\myProj\views"",

Alos here is my setup for jade in my app.js:
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'jade');
app.engine('jade', require('jade').__express);

So what am I doing wrong? Any help is appreciated...
UPDATED to use res.render:
Updated to use app.render:
So I changed my route to:
var express = require('express');
var router = express.Router();
var app;
module.exports = function (_app) {
    app = _app;
    return router;
}
router.get('/test', function (req, res, next) {
    app.render('test', {"message": "test1", "title": "test2"}, function(err, html){
         res.render(html);
    });  
});

and now I'm caling in this way in app.js:
var test = require('./routes/test');
app.use(test(app));

Now it gives me:
> "Failed to lookup view
> "<html><head><title>test2</title></head><body><h1>test1</h1></body></html>"
> in views directory "C:\node\myProj\views""

Although res.render works fine:
res.render('test', {"message": "test1", "title": "test2"});

A:

Looks like you are close but your request handler needs slight adjustment:
router.get('/test', function (req, res, next) {
    res.render('test', {"message": "test1", "title": "test2"}));
});

Because you set the view engine, res.render is now smart enough to do your jade for you
You can also omit the ./views prefix and .jade suffix again because express now understands these as defaults
You also don't need to require jade in your router file anymore

