DEV Community

Discussion on: Hacktoberfest 2021 — Who's Looking for Contributors?

Collapse
 
ksengine profile image
Kavindu Santhusa • Edited

Please contribute on docs of

GitHub logo ksenginew / nanoasgi

Fast⚡, simple and light💡weight ASGI micro🔬 web🌏-framework for Python🐍.

NanoASGI

Asynchronous Python Web Framework


NanoASGI is a fast, simple and light💡weight ASGI micro🔬 web🌏-framework for Python🐍. It is distributed as a single file module and has no dependencies other than the Python Standard Library.

Download and Install

Download ⬇️ nanoasgi.py into your project directory. There are no hard dependencies other than the Python standard library. NanoASGI runs with Python versions above 3.7.

Or install via pip

pip install NanoASGI
Enter fullscreen mode Exit fullscreen mode

Example

# example.py
from nanoasgi import App, Response
app = App()

@app.on('startup')
async def on_startup():
    print('Ready to serve requests')

@app.on('shutdown')
async def on_shutdown():
    print('Shutting down')

@app.route('GET', '/api/hello/{name}/')
async def hello_handler(request, name):
    return Response(
        {'result': f'Hello 
Enter fullscreen mode Exit fullscreen mode