why did ctx.params become undefined #1002
-
i followed this tutorial. but when I want to take the url parameter it's always undefined
i have created a file in routes/api/nice/[id].tsx and acess the url http://localhost:8000/api/nice/bobwatcherx |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
the file is called |
Beta Was this translation helpful? Give feedback.
-
and how to take parameters and display parameters to html?
now I want to get data as well as get parameter values from the url
example url http://localhost:3000/sample/MYPARAMS and i want see MyPARAMS in console terminal |
Beta Was this translation helpful? Give feedback.
the file is called
[id].tsx
so the params should have anid
property, notusername
.You are logging
username
which will be undefined.