'Express/Ejs appending localhost to script links in my index.ejs file
Route
app.get("/api/animation/:token_id", (req, res) => {
const tokenId = req.params.token_id;
const data = generateWorldData();
const templateVars = { tokenId };
res.render("index", templateVars);
});
Index.ejs
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Worlds NFT #<%= tokenId %></title>
<link rel="stylesheet" type="text/css" href="style.css" />
<script type="text/javascript" src="../libraries/p5.min.js"></script>
<script type="text/javascript" src="../libraries/p5.sound.min.js"></script>
</head>
<body>
hi
<script type="text/javascript" src="sketch.js"></script>
</body>
</html>
Im trying to render a p5.js sketch in my index.ejs page but the script tags are not working. they get appended with a localhost link in the browser. I want to link them to the files in my server directory.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
