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

149
Vistas
Making the client able to receive custom parameters from a URL using Express/NodeJS

I am trying to create a nodeJS/Express site where users are able to create posts. Each post has its own id (consisted of 6 random characters). I want to make it so that when a user enters the URL http://localhost:3000/post/123456/, the user sees HTML on their screen but the id of the post they're trying to see, that means the second parameter in the URL (In this case, 123456) is given to the client.

For example, if the user goes on http://localhost:3000/post/111111/, I want the client to see HTML, but, I want the Javascript on that page to receive that id (111111), either in a variable or in a cookie.

I've tried using express app.get, like this:

app.get("/post/:id", (req, res) => {
    req.send(req.params.id)
})

But, obviously that didn't work, since that doesn't send back HTML, but instead sends back a string. Is there any way of doing that, or at least something similar to that?

about 4 years ago · Juan Pablo Isaza
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