Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

340
Views
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 answers
Answer question

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 Report

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!