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!
You can try using the following code into app.get function
res.sendFile(__dirname+/index.html");