emmett-framework / emmett

The web framework for inventors
Other
1.03k stars 70 forks source link

Introduce `AppModuleGroup` #436

Closed gi0baro closed 1 year ago

gi0baro commented 2 years ago

Useful for conditions where the same route should be routed on two different endpoints with different pipelines.

Usage should look like this:

mod1 = app.module(__name__, "mod1", url_prefix="v1")
mod2 = app.module(__name__, "mod2", url_prefix="v2")

mod1.pipeline = [SomePipe()]
mod2.pipeline = [SomeOtherPipe()]

gmod = app.module_group(mod1, mod2)

@gmod.route()
async def foo():
    ...