Custom routing on a per-collection basis #587
GeorgeyB
started this conversation in
Feature Requests & Ideas
Replies: 2 comments 8 replies
-
This is great! And it would be pretty easy to accomplish I think. We have our hands full with other features, but if anyone wants to tackle this in the interim, we would be happy to collaborate! |
Beta Was this translation helpful? Give feedback.
5 replies
-
@DanRibbens and I were just talking about this idea and we have come up with a direction that we think is appropriate. const ExampleCollection = {
// Collection config here
endpoints: [
{
route: '/say-hello/:name/',
method: 'get',
handlers: [
(req, res) => {
return res.json({ message: `hello ${req.params.name}` });
},
],
},
],
} Here is our thinking:
Other notes:
What do we all think? @JarrodMFlesch @DanRibbens @GeorgeyB |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
What's the Payload convention for introducing custom routes on a per-collection basis? Currently I'm importing custom routers into
server.ts
, but it could get messy.I think it would be neat to have a way of providing custom routes to our collection configurations that'd be matched before the payload routes in
src\collections\init.ts
. As an example:Any thoughts on this?
Apologies if there's already a neater way to do this that I've missed. 🙂
Beta Was this translation helpful? Give feedback.
All reactions