Raathigesh / atmo

:heavy_check_mark: Mock data for your prototypes and demos. Remote deployments to Zeit now.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

dynamic urls/endpoints

pantchox opened this issue · comments

Hello,

lets say i have a URL api/users/$userId/invoices/$invoiceId
how can i implment this in the URL and in the response type set to javascript, get the specific URL endpoints dynamic variables, to my coding and send back a dynamic response?

thanks!.

ok found the solution like express
in the url you set it to dynamic with api/users/:userId/invoices/:invoiceId
in the response you select 'Javascript'
and in the code you can get the values by using req.params.
example response javascript code:
res.send(req.params);
it will return the dynamic parameters values.

Awesome! That should be the way. Never tested it though but glad to know that it's working :)