Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

109
Views
Express sendFile breaks

I am constantly getting:

express deprecated res.sendfile: Use res.sendFile instead 

here is my code:

app.get('/*', function (req, res) {

  var myUrl = req.url.split('/')[1];

  myownfunction(myUrl, function (err, rows) {

    if (rows.length != 0) {
      res.sendfile('views/article.html');
    }
    else
    {
      res.sendfile('views/404.html');
    }
  });
});

I changed the sendfile to uppercase sendFile, but it breaks. what should i do?

update

when I run my code:

app.get('/upload', function(req, res){
  res.sendFile('views/upload_file.html');
});

I get this error: TypeError: path must be absolute or specify root to res.sendFile

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Use path.join() function to configure file path.

app.get('/upload', function(req, res){
  res.sendFile(path.join(__dirname,"views/upload_file.html"))
});
about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!