getludic / ludic

🌳 Web Development in Pure Python with Type-Guided Components.
https://getludic.dev
MIT License
743 stars 14 forks source link

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

Open barapa opened 7 months ago

paveldedik commented 7 months ago

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)
Mte90 commented 5 months ago

Wondering also for Django...

paveldedik commented 5 months ago

@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.

Mte90 commented 5 months ago

Ops I missed that issue