Skip to content

baguette 0.0.3

Compare
Choose a tag to compare
@takos22 takos22 released this 17 Apr 22:37
· 202 commits to master since this release
8a9e47b

baguette 0.0.3

I changed quite some things in the module over the last few days and I’m happy to announce that the docs have improved a lot, despite still needing more docstrings in the code itself. The biggest change is that the @app.endpoint decorator was renamed to @app.route as it made more sense with the implementation of a Router class.

Here's a new basic example:

from baguette import Baguette

app = Baguette()

@app.route("/")
async def index(request):
    return "<h1>Hello world</h1>"

And here's another example using class based views:

from baguette import Baguette, View

app = Baguette()

@app.route("/home")
class Home(View):
    home_text = "<h1>Home</h1>"

    async def get(self, request):
        return self.home_text

    async def post(self, request):
        self.home_text = await request.body()
        return self.home_text

As you can see it’s still pretty straight-forward and easy to use.

Links

PyPi: https://pypi.org/project/baguette/
Docs: https://baguette.readthedocs.io/
Discord support server: https://discord.gg/PGC3eAznJ6