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

160
Views
Next.js does not recognize dynamic routes with square brackets names

enter image description hereI have this directory structure:

 - pages 
   - api
     - products 
       - pro
         - [id].js
     - add.js

[id].js

import { upload, baseHandler } from 'helpers';
import { sequelize } from 'lib';
import { init, Suppliers, Products} from 'models';
import { supplierController, productController } from 'controllers';

const handler = baseHandler.get( async (req, res) => {
    const {
        query: { id, name },
        method,
      } = req

    init()

    res.status(400).json(id)
})
 
export default handler;

export const config = {
  api: {
    bodyParser: false,
  },
};

The static routes works fine but not the dynamic ones. I get this error when I try to access them error - Error: getaddrinfo ENOTFOUND api.example.com which means Next.js does not add dynamic routes from the file system.

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!