You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a bit more complex, for routes of form /a/:param/b where :param is dynamically passed and multiple URLs are generated for the single route.
The :param argument should be a iterable or a function and GenieBuilder.build should generate all the different pages for the route, corresponding to all the elements.
Architectural questions:
1/ can we handle one param and multiple params at once? That would be ideal. Maybe if we define some sort of interface and only use functions which must return a NamedTuple of :params at each iteration.
Such routes look like: /a/:param1/b/:param2
-> the challenge here is the combinations of param1 and 2 - ex if we have users and orders, we'd have users from id A to id Z, and for each user we'd have orders from id A to id Z.
2/ how do we define these rules? We could use a static.jl file where for each route we define the iterator -- but this would duplicate the routes definitions. I think the best would be for GenieBuilder to specialize Genie.Router.route to accept an extra argument, a lambda for the iterator rule.
So basically the routes.jl file would look like this:
using GenieStatic
route(...; ...existing_kw_args..., static_iterator=() ->...)
This iterator lambda could use for example a database result.
The text was updated successfully, but these errors were encountered:
This is a bit more complex, for routes of form /a/:param/b where :param is dynamically passed and multiple URLs are generated for the single route.
The :param argument should be a iterable or a function and GenieBuilder.build should generate all the different pages for the route, corresponding to all the elements.
Architectural questions:
1/ can we handle one param and multiple params at once? That would be ideal. Maybe if we define some sort of interface and only use functions which must return a NamedTuple of :params at each iteration.
Such routes look like: /a/:param1/b/:param2
-> the challenge here is the combinations of param1 and 2 - ex if we have users and orders, we'd have users from id A to id Z, and for each user we'd have orders from id A to id Z.
2/ how do we define these rules? We could use a static.jl file where for each route we define the iterator -- but this would duplicate the routes definitions. I think the best would be for GenieBuilder to specialize Genie.Router.route to accept an extra argument, a lambda for the iterator rule.
So basically the routes.jl file would look like this:
This iterator lambda could use for example a database result.
The text was updated successfully, but these errors were encountered: