emmett-framework / emmett

The web framework for inventors

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Introduce `AppModuleGroup`

gi0baro opened this issue · comments

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():
    ...