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

290
Views
Set default page number in query parameter with Joi

I'm trying to set query parameter with a default page number. What I want is if a request comes to this route without having query param "page" then Joi should set its default value in

req.query.page = 1

But currently I'm not getting this default value in the

req.query.page

router.get(
  "/likes",
  validate({
    query: Joi.object({ page: Joi.number().default(1) }),
  }),
  async function (req, res, next) {
    const page = parseInt(req.query.page);
    try {
      some code here
    } catch (error) {
      next(error);
    }
  }
);
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!