Next.js Discord

Discord Forum

API Unknown route

Unanswered
Siamese Crocodile posted this in #help-forum
Open in Discord
Avatar
Siamese CrocodileOP
Is there a way to make it so I can return a json response when an api route is not known? For example /api/fdshajfshadjkehsjfshejfsh (undefined) would return a json response instead of my not-found.ts file?

1 Reply

Avatar
Asian black bear
How about using a catch all route in /api?