'Double path x 2 in jscript

Hello here is my code in jscript file:

    app.get('/:pathlink', function(req, res) {
    const path = req.params.pathlink;
    switch (path) {
    case "acceuil":
        console.log("Here is acceuil");
        res.sendFile(__dirname + "/views/acceuil.html");
        break;
    default:
        console.log("its not acceuil");

And in another jscript file i'm doing this:

    location.href = "acceuil";
    

The problem is that i'm getting this on my console:

     Here is acceuil
     Here is acceuil

It's going 2 times on the same page can someone help me? I would like it to just go one time instead of two.

Thankyou!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source