I have some issue with express in my simply javascript app. I want to make a repository for URLs. On my page I display all links with this code:
const allLinks = links
.map((link) => {
const { _id: linkID, name, area, address } = link;
return `
<h5>${name}</h5>
<h5>${area}</h5>
<div>${address}</div>
<!-- edit link -->
<a href="edit.html?id=${linkID}" class="">
edit
</a>
<!-- delete btn -->
<button type="button" class="delete-btn" data-id="${linkID}">
delete
</button>
</div>`;
})
.join('');
linksDOM.innerHTML = allLinks;
Then on my page I see for example link (address) like: www.google.com. I've tried to make a clikable link from it (a tag, on click button), but there's an issue with it. Probably express treats it like link inside app and adds before the link http://localhst:3000, so it goes like http://localhost:3000/www.google.com and of course doesn't work. Same is when I right click and copy link. I just want an external working link, without localhost:3000.
How I can to prevent app/express to do this. Does anyone can help me, please ?