- Add HTML rendering
- Add redirects
Example code
`main.py`
py
from baguette import Baguette, redirect, render
app = Baguette()
app.route("/")
async def index():
return redirect("/home")
app.route("/home")
async def home(request):
user = ... do some user handling, lets assume user has a name attribute
return render("home.html", username=user.name)
`templates/home.html`:
html
<html>
<head>
<title>Home</title>
</head>
<body>
<h1>Hello {{ username }}!</h1>
</body>
</html>
Links
PyPi: https://pypi.org/project/baguette/
Docs: https://baguette.readthedocs.io/
Discord support server: https://discord.gg/PGC3eAznJ6