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 details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

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

Uploaded Python 3

File details

Details for the file xweb_router-0.1.0.tar.gz.

File metadata

  • Download URL: xweb_router-0.1.0.tar.gz
  • Upload date:
  • Size: 2.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.5

File hashes

Hashes for xweb_router-0.1.0.tar.gz
Algorithm Hash digest
SHA256 29f4dedd2fe38c8fab12f96744ceaf816b77257f16a6e76c94a51db0ac96316e
MD5 8942200547c3c9b36240886f0bcc23d5
BLAKE2b-256 0ec26efc1ef6f0f89573f28c1f6358c61619956d370ebe79d0571fd010e406c5

See more details on using hashes here.

File details

Details for the file xweb_router-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: xweb_router-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 2.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.5

File hashes

Hashes for xweb_router-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e71b0ff2374888671fd47b0e4df74daf27d9fc225430f1b963862553c593f9f7
MD5 b190523951d124486edfb31d9add165f
BLAKE2b-256 1c2cab3859416497582a2ca77b1a4dfef96d840e991e267dd47b2309da2e1b09

See more details on using hashes here.

Supported by

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