First Steps
Tanoshi is an extremely simple framework to get started with. A really simple Tanoshi website could look like this:
from tanoshi import (
Tanoshi,
PlainTextResponse,
Request
)
app = Tanoshi()
@app.route("/")
async def index(request: Request):
return PlainTextResponse("Hello World!")
If this code were inside a main.py
file, you could simply run it like so:
uvicorn main:py --reload
INFO: Started server process [21748]
INFO: Waiting for application startup.
INFO: Application startup complete.
INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
Note
The command uvicorn main:app
refers to:
main
: the filemain.py
(the Python "module").app
: the object created inside ofmain.py
with the lineapp = Tanoshi()
.--reload
: make the server restart after code changes. Only use for development.