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

180
Views
how to send data on file with sendFile in express

I am trying to parse my csv file in server and return back the information after parsing and analyzing the data in csv.

I am not that used to express and i dont know any view engine.

I plan to use

res.sendFile(path.join(__dirname, "/index.html"));

to host my index file.

What are the other way than ajax and view template that can I send data to the index.html with sendFile.

I am sending JSON files from server to client

Any kind of help is appreciated !!!

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

When a client (such as a browser) makes a request you can respond with one thing.

You can respond with:

  • The contents of a file as you are now (although you should use the static middleware instead of rolling your own end point handlers (without caching) one-by-one)
  • A template + some data rendered into a single file (using the view engines you haven't gotten around to learning yet)
  • Some JSON (typically in response to an Ajax request so the a JS program running in an HTML document get add more data to the existing HTML page)
  • Something else

If sending an unmodified file is not what you want, then don't use sendFile.

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!