Next.js Discord

Discord Forum

Can i use dynamic routes on the server side (NextJS API)

Answered
oguisantosilva posted this in #help-forum
Open in Discord
Good Evening!

I wanted to know if i can use dynamic routes in the server side (API) in next js 15 using app router.

Or if i need to send the param in the body.

Thanks!
Answered by joulev
export async function GET(request, { params }) {
  // console.log(await params);
}
View full answer

4 Replies

@joulev yes you can, `app/api/[slug]/route.js`
and how i can get the param in the code?
@oguisantosilva and how i can get the param in the code?
export async function GET(request, { params }) {
  // console.log(await params);
}
Answer
thanks!