Next.js Discord

Discord Forum

Dynamic api route returning an empty object

Answered
Blue-throated Hummingbird posted this in #help-forum
Open in Discord
Blue-throated HummingbirdOP
I have the following code, when I navigate to this route http://localhost:3000/api/user/test I get {} I am expecting it to be the slug, { userId: 'test' } is there anything wrong with my code or my file structure?
Answered by joulev
export async function GET(request, { params })
View full answer

3 Replies

export async function GET(request, { params })
Answer
Blue-throated HummingbirdOP
thank you so much