Hey @ivkemilioner, for starters I recommend tagging your post with help to reach more people.
Anyways, if I understand your question correctly, you want to pass collections as an outside parameter to your API endpoint? I recommend checking the documentation, you can use query parameter to pass data to your endpoint.
For example, if you access your API route like this: /api/qapages?collection=questions, you can read the collection query parameter via req.query:
Hey @ivkemilioner, for starters I recommend tagging your post with
help
to reach more people.Anyways, if I understand your question correctly, you want to pass
collections
as an outside parameter to your API endpoint? I recommend checking the documentation, you can use query parameter to pass data to your endpoint.For example, if you access your API route like this:
/api/qapages?collection=questions
, you can read thecollection
query parameter viareq.query
:However, make sure to validate the incoming parameter so it's possible to access only collections which should be accessible this way.
Thank you very much! I fixed !