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

339
Vistas
Node Express dynamic route/path

How can I implement and get a dynamic route or path with Express package? The main problem is the path is an id pass by the client and had no control over it.

const express = require('express');
const dynamic_path= express();


dynamic_path.get('/user', (req, res) => {

});

exports.v1 = functions.runWith(runtimeOpts).https.onRequest(dynamic_path);

The above will result as https://my-app.net/v1/user and the client request will be https://my-app.net/v1/user/user_id. I need to allow dynamic path and I need to get the value of user_id as well for future usage.

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

Added :user_id to the route.

dynamic_path.get('/user/:user_id', (req, res) => {
  const user_id = req.params.user_id;
});
about 4 years ago · Juan Pablo Isaza Denunciar

0

Use the route:

https://my-app.net/v1/user/:user_id

Your code will be like this:

dynamic_path.get("/user/:user_id" , (req, res)=>{
    let user_id = req.parmas.user_id
}
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