Next.js Discord

Discord Forum

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

Answered
Texas leafcutting ant posted this in #help-forum
Open in Discord
Avatar
Texas leafcutting antOP
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

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