https://github.com/ksengine/nanoasgi-1
NanoASGI is a fast, simple and lightweight ASGI micro web-framework for Python.
https://github.com/ksengine/nanoasgi-1
Last synced: 3 months ago
JSON representation
NanoASGI is a fast, simple and lightweight ASGI micro web-framework for Python.
- Host: GitHub
- URL: https://github.com/ksengine/nanoasgi-1
- Owner: Ksengine
- License: mit
- Created: 2020-12-23T07:13:02.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2020-12-23T07:12:50.000Z (over 5 years ago)
- Last Synced: 2025-10-19T15:37:53.349Z (8 months ago)
- Size: 25.4 KB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README


# NanoASGI: Asynchronous Python Web Framework
NanoASGI is a fast, simple and lightweight [ASGI](https://asgi.readthedocs.io "Asynchronous Server Gateway Interface") micro web-framework for Python. It is distributed as a single file module and has no dependencies other than the [Python Standard Library.](http://docs.python.org/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
```python
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')],
)
```
```bash
uvicorn example:app
```
## License
Code and documentation are available according to the MIT License (see [LICENSE](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](#logo) - [Perditax](https://commons.wikimedia.org/wiki/File:C20_Fullerene.png), CC0, via Wikimedia Commons