Replies: 2 comments 1 reply
-
|
If you go the Flask way, you also need support for something like Blueprints. The starlette style (that is also the Falcon and Pyramid style – and I believe Django?) has the upside that the routes configuration is centralized. I can live with both. |
Beta Was this translation helpful? Give feedback.
-
|
i agree, for 99% of cases decorator style apis are nicer for "registration" apis. but i usually prefer to implement those decorators on top of a more conventional "register(thing, callback, whatever=else)" api, so you can have the best of both worlds. i believe flask itself does just that, making it possible to have centralized routing or even a mix. this can be useful in some cases, e.g. when conditionally adding a route. cases like that often depend on some kind of configuration (e.g. DEBUG=1 env var), and that can be annoying to do with decorators, because those are typically used at the module level, and hence executed at import time. (i personally don't like functions that magically behave like a decorator sometimes, and typing them is not nice, requiring overloads and unions etc) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm brainstorming API registration syntaxes.
The contenders:
RouteDef))I think it's a no-brainer, Flask wins hands down. Still, maybe worth considering the alternatives.
@hynek @wbolster
Beta Was this translation helpful? Give feedback.
All reactions