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

296
Views
req.params undefined when trying to find something in postgresql

Hey I'm making reset password route (EXPRESSJS) and I have a problem. My route looks like this: /reset-password/:resetToken.

And I get it like that: const token = req.params.resetToken

When I console.log that variable it logs it without any errors but when I try to check if it is in db it return as undefined

Some code:

AuthRouter.put("/reset-password/:resetToken", async (req, res) => {
  const token = req.params.resetToken

 try {

    console.log(token);
    const getResetToken = await pool.query("SELECT * FROM users WHERE user_password_reset_token = $1", [
      token
    ])  
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Try add `` instead of " in query

`SELECT * FROM users WHERE user_password_reset_token = $1`
about 4 years ago · Juan Pablo Isaza Report

0

Hey you can try this one, It will work on dynamic values:

const getResetToken = await pool.query(
    `SELECT * FROM users WHERE user_password_reset_token = $1`,
    [token]
)
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!