Skip to content
This repository has been archived by the owner on Feb 22, 2022. It is now read-only.

ksenginew/nanoasgi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NanoASGI

Asynchronous Python Web Framework


NanoASGI is a fast:zap:, simple and light:bulb:weight ASGI micro:microscope: web:earth_asia:-framework for Python:snake:. 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

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

Then run your app with your favourite ASGI server.

uvicorn example:app

Status

GitHub license PyPI PyPI - License PyPI - Status PyPI - Format PyPI - Downloads PyPI - Wheel PyPI - Python Version

License

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

About

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

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages