Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

142
Vistas
Why the script file is on my req.params how to get rid of that?

I'm trying to extract the :rid to my req.params but I get two values the rid and the script file.

here is the console.log picture

console.log picture

my route code

router.get('/room/:rid', async (req, res) => {
  console.log(req.params);
  res.render('room', { roomId: req.params.rid });
});
 

my dashboard code to redirect the user to room.ejs when the user click

 function goto(){
    var roomID = document.getElementById("roomID").value;

    window.location.replace(`/room/${roomID}`);

 }

and my room.ejs head

<script src="this.js" defer></script>
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Change this:

<script src="this.js" defer></script>

to this:

<script src="/this.js" defer></script>

Assuming that script was present in a web page called /room, then when the browser sees a request for "this.js", it will combine that with the path of the page and ask for /room/this.js which will hit your /room/:rid route which is not what you want.

Generally, you always want script file paths to be absolute paths (start with a /) so they are fixed and not dependent upon the path of the page they are contained in .

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda