express js error : “express deprecated res.sendfile: Use res.sendFile instead”

后端 未结 3 1968
情书的邮戳
情书的邮戳 2021-02-18 15:35

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   
          


        
3条回答
  •  醉梦人生
    2021-02-18 16:10

    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.

提交回复
热议问题