Next.js Discord

Discord Forum

Accessing slug value in app router v14

Unanswered
Whiskered Screech-Owl posted this in #help-forum
Open in Discord
Whiskered Screech-OwlOP
I have an api route using the app router: /api/posts/[postId]/route.js
How can I access the postId slug, in pages router I would do something like req.query.postId is there an equvalent in app router?

1 Reply

Whiskered Screech-OwlOP
Or should I just use a regex to extract it from the URL?