Having a issue figuring out how to navigate between EJS pages effectively:
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<h1> <a href="about.ejs"> This is a link to about page</a></h1>
</body>
</html>
const express = require("express");
const path = require('path');
const app = express();
app.set("views", path.resolve(__dirname, "views"));
app.set("view engine", "ejs")
app.get("/", (req, res) => {
res.render("index")
});
app.use(express.static('public'));
app.listen(3000);
You should render about.ejs template to use it on the client. To do that, you need to create a new route:
app.get("/about", (req, res) => {
res.render("about");
});
To open it use /about
path.