Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hzlmn/sketch
Tiny aiohttp clone, made for learning purposes
https://github.com/hzlmn/sketch
aiohttp asyncio
Last synced: about 1 month ago
JSON representation
Tiny aiohttp clone, made for learning purposes
- Host: GitHub
- URL: https://github.com/hzlmn/sketch
- Owner: hzlmn
- Created: 2019-01-11T11:29:15.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-08-19T09:54:50.000Z (about 5 years ago)
- Last Synced: 2024-08-03T09:10:32.591Z (4 months ago)
- Topics: aiohttp, asyncio
- Language: Python
- Homepage:
- Size: 13.7 KB
- Stars: 8
- Watchers: 3
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
### Features :sparkles:
- Application container
- Lifecycle hooks
- Middlewares
- Routing
- Request/Response helpers### Overview
To give you a first grasp, here is simple example of app made with `sketch`
`app.py`
```python3
import asynciofrom sketch import Application, Response, run_app
loop = asyncio.get_event_loop()
async def handler(request):
username = request.match_info["username"]
return Response(f"Hello, {username}")app = Application(loop)
app.router.add_route("GET", "/{username}", handler)
if __name__ == "__main__":
run_app(app, port=8080)```
```shell
$ python app.py
>> Started server on 127.0.0.1:8080
``````shell
$ curl http://127.0.0.1:8080/oleh
>> Hello, oleh
```### License
MIT