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

112
Views
Cómo pasar la variable a la solicitud GET después de recibirla de la solicitud POST

No puedo averiguar cómo pasar una variable a la solicitud GET después de recibirla desde la interfaz.

 app.post('/subcategories', (req, res) => { //receive category id from front const category_id = req.body.category; }) app.get('/subcategories', (req, res) => { // need to replace the 25 with the variable I recieved from the above POST request const category_id = 25; db.query('SELECT subcategory_name FROM subcategories WHERE category_id=(?)', [category_id], (err, result) =>{ res.send({result}) }); })
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Puede pasar directamente el category_id a GET usando parámetros de consulta.

Haz algo como:

 /subcategories?category_id=25

atraparlo en la API GET usando:

 let category_id = req.query.category_id
about 4 years ago · Juan Pablo Isaza Report

0

puede pasar category_id como una consulta al realizar una solicitud de obtención y tomar el category_id en la ruta '/subcategories' usando req.query .

hacer obtener solicitudes como esta.

 /subcategories?categoryid=25

obténgalo en un objeto de consulta como este.

 let categoryId = req.query.categoryid
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!