https://github.com/akiacode/gazi
A lightweight, class-based, easy-to-use ASGI framework
https://github.com/akiacode/gazi
Last synced: 7 months ago
JSON representation
A lightweight, class-based, easy-to-use ASGI framework
- Host: GitHub
- URL: https://github.com/akiacode/gazi
- Owner: AkiaCode
- License: mit
- Created: 2021-07-27T15:37:54.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-08-13T08:46:51.000Z (over 4 years ago)
- Last Synced: 2025-07-06T21:02:28.084Z (7 months ago)
- Language: Python
- Homepage: https://pypi.org/project/gazi
- Size: 24.4 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gazi
A lightweight, class-based, easy-to-use ASGI framework
### Docs
* main.py
```python
from gazi import App
from home import _ as Home
from api import API
app = App()
app.handlers([Home, API])
```
* home.py
```python
from gazi.route import method
from gazi.response import HtmlResponse, Response
# Path: /*
class _:
def __init__(self) -> None:
pass
# Path: /
@method.GET
def __render__(self) -> Response:
return HtmlResponse("
Hello, world!
")
```
* api.py
```python
from gazi.response import HtmlResponse, Response
from gazi.request import Request
from gazi.route import method
# Path: /api/*
class API:
def __init__(self) -> None:
pass
# Path: /api
@method.GET
def __render__(self) -> Response:
return Response("API")
# Path: /api/hello
@method.GET
def hello(self, request: Request) -> Response:
return HtmlResponse(
f"
Hello world, Username: {request.query('name')}
", # data
{"test1": "test", "asd": "a"}, # headers
)
# Path: /api/bye?name=test
@method.POST
def bye(self, request: Request) -> Response:
return HtmlResponse(f"
Bye world, Username: {request.query('name')}
")
```