Next.js Discord

Discord Forum

Traditional API route vs App directory?

Unanswered
Sloth bear posted this in #help-forum
Open in Discord
Sloth bearOP
In the pages/api directory, you can use a dynamic route with a catch-all route ([...slug].js or .ts) to handle multiple segments.

How is that done in Next.js 14 with app directory?

3 Replies

app/api/[...slug]/route.js
@Ray `app/api/[...slug]/route.js`
Sloth bearOP
Thanks!