expressjs - not sending the file from view config

In my node app, I configured the views folder, later simply I am passing the html name alone. now the html file need to load from using the views config + html file right. ( am I wrong!)

But it's not working. any one give me the suggestion please?

here is my code :

var express = require('express'),
    http = require('http'),
    jade = require('jade'),
    app = express();

app.set('view engine', 'jade');
app.set('views', __dirname + '/views'); // i configured the path so i am passing file name alone on get.

app.get('/', function(req,res){
    res.sendfile('index.html'); //it's not working
    res.sendfile('views/index.html') //it works
});

http.createServer(app).listen(3000, function () {
  console.log('Express server listening on port ');
});

thanks in advance

You appear to have a misconception about what the view engine is. The view engine takes some non-HTML code, and transforms it into HTML. Here, you have it set to use jade.

The view engine is only good with the res.render() function. res.sendfile() merely sends a file from the current directory -- not the views directory.

Using express if you want to serve some static HTML files. You can just put those files directly in public folder.

When server will get a GET request of / it will search for /public/index.html serve that as response. You don't have to add router for that /.

Other wise if you want to use some template views then you have to use some views engine.