i'm building this application using node and express js, on the front end i have an anchor element like this:
<a href="/tutorials/tut1" target="_blank" id="tutorialLink">tut 1</a>
now this opens and works perfectly on localhost, but when deployed i get cannot Get error. it's supposed to serve a static HTML file that is stored in 'tutorials' directory. i tried doing this
app.use("/tutorials", express.static('tutorials'));
and this (with all kinds of path formatting):
app.get("/tutorials/:tutname", (req, res) => {
let tutname=req.params.tutname;
res.sendFile(__dirname+`/tutorials/${tutname}.html`); //also tried res.sendFile(`${tutname}.html`,{root:__dirname});
})
both those ways worked perfectly on local host, but as i said above when i deploy i get "Cannot GET /tutorials/tut1" error
my app is deployed to a digitalocean vps and i'm using nginx on it, i should mention that serving other static files/images/scripts works perfectly with no problems as well