Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

express js error : "express deprecated res.sendfile: Use res.sendFile instead"

What is the right way to set path?

in my app i this code for i use set path for sending file.

app.get('/',function(req, res){//get,put,post,delete   
  res.sendfile(__dirname + '/client/views/index.html');
});

but it give this error:

express deprecated res.sendfile: Use res.sendFile instead server.js:22:6

can some to point what is the error here.please

like image 595
hash Avatar asked Oct 05 '14 11:10

hash


1 Answers

Change this

 app.get('/',function(req, res){//get,put,post,delete   
      res.sendfile(__dirname + '/client/views/index.html');
    });

to this and this should work.

app.get('/',function(req, res){//get,put,post,delete   
      res.sendFile(__dirname + '/client/views/index.html');
    });

In new versions sendfile has been deprecated. Change sendfile to sendFile.

like image 191
Jayram Avatar answered Oct 31 '22 22:10

Jayram