Skip to main content

Router middleware for xweb.

Project description

xweb-router

Router middleware for xweb

from xweb import App

from xweb_router import Router

app = App()
router = Router()

app.use(router)


@router.use('/')
async def xxx(ctx, fn):
    print('middleware')
    await fn()


@router.get('/')
async def hello(ctx):
    ctx.body = "Hello World!"


@router.post('/home')
async def home(ctx):
    ctx.body = "Home"


@router.patch('/index')
async def index(ctx):
    ctx.body = "Index"


if __name__ == '__main__':
    app.listen(8000)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xweb_router-0.1.0.tar.gz (2.1 kB view hashes)

Uploaded Source

Built Distribution

xweb_router-0.1.0-py3-none-any.whl (2.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page