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

206
Views
Obtenga el parámetro de consulta express.js dinámicamente

Así que tengo este código, que verifica si un argumento es dado o no y si tiene un valor o no.

 const isSetAndNotEmpty = (parameter) => { return (req, res, next) => { //Define param ( is there a way to make this working with the parameter from above ) const param = req.query.id; //Check param if (!param || typeof (param) === 'undefined') { return res.json({ success: false, message: `Argument '${parameter}' is missing or empty!` }); } next(); }; };

¿Hay alguna manera de dar a la variable param el mismo valor que el parámetro? Porque la forma en que veo que funciona es que lo que sea que proporcione el req.query.xxx lo tomará como un parámetro de consulta.

Simplemente decir que req.query.parameter no funciona debido a que se tomará como un parámetro de consulta.

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