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
Release history Release notifications | RSS feed
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)
Built Distribution
Close
Hashes for xweb_router-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e71b0ff2374888671fd47b0e4df74daf27d9fc225430f1b963862553c593f9f7 |
|
MD5 | b190523951d124486edfb31d9add165f |
|
BLAKE2b-256 | 1c2cab3859416497582a2ca77b1a4dfef96d840e991e267dd47b2309da2e1b09 |