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

95
Views
Showing index.html file with node.js

This is my first topic, and I'm not really that great with js, but how do I get my index.html file to show up? This is what I have.

const express = require("express");
const app = express();
const PORT = process.env.PORT || 3000


app.get("/", function (req, res) {
    res.send("hello!")
});

app.listen(PORT, function () {
    console.log("Server is running on localhost:" + PORT);
});

app.js and index.html are in the same directory. Thanks!

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

0

You can try using the following code into app.get function

res.sendFile(__dirname+/index.html");

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!