Including routes from shards #1444
Unanswered
matthewmcgarvey
asked this question in
Feature requests & Ideas
Replies: 2 comments 4 replies
-
shield comes to mind since it has a bunch of modules that you have to include in your own routes to get the functionality instead of defining the routes. |
Beta Was this translation helpful? Give feedback.
0 replies
-
I actually don't mind how it's currently done. To me it makes sense that as soon as you require the shard, you have the routes. No need for extra configurations. With Breeze, we basically want each new extension to manage it's own additional routes. You include the extension, then you get the added routes. I think the current way also gives us the added type-checking at compile-time. |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The way lucky routes work, routes are essentially "self-registered". By declaring a route in a file and requiring the file, the route gets loaded. That's fine for routes made within the app, but consider routes that are defined in shards.
Say I created an admin dashboard shard that creates routes to allow you to manage all the things in your app. If I create those routes the normal way, those routes will be included as soon as the shard is required and will be publicly available. Ideally, they would be behind an admin login but with the way things work today, it's up to the shard to implement that functionality or to monkey-patch it in.
You can see this with breeze right now, as soon as breeze is required the endpoints exist and it is up to the provided shard configuration to remove the routes if the user doesn't want them on in certain conditions. https://github.com/luckyframework/breeze/blob/5a98f72cd0d5282b6aeb71d1e02fe70ae7c06456/src/breeze/actions/breeze_action.cr#L8
Is this the way we want to keep going or do we want to consider alternatives?
Beta Was this translation helpful? Give feedback.
All reactions