ludic icon indicating copy to clipboard operation
ludic copied to clipboard

Add helpers and write documentation on how to embed the framework in an existing fastapi app

Open barapa opened this issue 1 year ago • 4 comments
trafficstars

barapa avatar Mar 21 '24 14:03 barapa

Hi, thank you for taking an interest in the framework.

I was already trying to integrate the framework in FastAPI, but it requires some tweaking and I haven't finished it yet.

Right now, your only option is to do something like this in FastAPI endpoints:

from fastapi import FastAPI
from ludic.html import p, b
from ludic.web.responses import LudicResponse

app = FastAPI()


@app.get("/")
def read_root() -> LudicResponse:
    content = p("Hello ", b("World"))
    return LudicResponse(content)

paveldedik avatar Mar 22 '24 13:03 paveldedik

Wondering also for Django...

Mte90 avatar Jun 04 '24 16:06 Mte90

@Mte90 I have an open issue for that - https://github.com/paveldedik/ludic/issues/13

But first, I want to have a better integration for FastAPI. These are now one of my top priority issues, so hopefully, I'll check it soon.

paveldedik avatar Jun 07 '24 10:06 paveldedik

Ops I missed that issue

Mte90 avatar Jun 07 '24 10:06 Mte90