Skip to content

NanoASGI is a fast, simple and lightweight ASGI micro web-framework for Python.

License

Notifications You must be signed in to change notification settings

Ksengine/NanoASGI-1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

logo logo text

NanoASGI: Asynchronous Python Web Framework

NanoASGI is a fast, simple and lightweight 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.

Example

example.py

from nanoasgi import App


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 {name}!'},
        status=200,
        headers=[('Content-Type', 'application/json')],
    )
uvicorn example:app

License

Code and documentation are available according to the MIT License (see LICENSE).

The Bottle logo however is NOT covered by that license. It is allowed to use the logo as a link to the repo or in direct context with the unmodified library. In all other cases, please ask first.

LOGO - Perditax, CC0, via Wikimedia Commons

About

NanoASGI is a fast, simple and lightweight ASGI micro web-framework for Python.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages