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

137
Views
How can I get html file from another folder with express?

currently I am using html file inside same folder.So how can I get a html file saved in different folder using express. Thank you.

    const express=require('express')
const path=require('path')
const app=express()

app.get('/',function(req,res){
res.sendFile(path.join(__dirname,'index.html'))
})

app.get('/about',function(req,res){
    res.send('about')
})

app.listen(3000,function(){
    console.log('Server Online')
    
})
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

for a given url return the path of your file

app.get('/yourUrl',function(req,res){
res.sendFile("path/to/your/file.html"))
})

in your specific case try about.html instead of about?

about 4 years ago · Juan Pablo Isaza 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!