volfpeter / fasthx

FastAPI server-side rendering with built-in HTMX support.
https://volfpeter.github.io/fasthx/
MIT License
458 stars 9 forks source link

Fully fledged Jinja2 example added. #3

Closed hasansezertasan closed 10 months ago

hasansezertasan commented 10 months ago

I used Bootstrap 5 to give it a bit of style.

I followed the common base.html structure for templating.

I tried to showcase all the features of the Jinja class.

Resolves: #2

volfpeter commented 10 months ago

Thank you very much! I'll review and test it as soon as I can.

In the meantime, could you please also add a link to the example in the Jinja section of README.md and docs/index.md (exact copy of README.md as of now).

hasansezertasan commented 10 months ago

Thank you very much! I'll review and test it as soon as I can.

You're welcome 👍

In the meantime, could you please also add a link to the example in the Jinja section of README.md and docs/index.md (exact copy of README.md as of now).

I just did 🚀

BTW, this example has the same amount of lines as fasthx/main.py file.

volfpeter commented 10 months ago

Yeah, this is not a big project :slightly_smiling_face: Actually my primary goal with it was to create a correctly implemented and typed FastAPI route decorator. HTMX was just a trivial use-case.

hasansezertasan commented 10 months ago

Yeah, this is not a big project 🙂 Actually my primary goal with it was to create a correctly implemented and typed FastAPI route decorator. HTMX was just a trivial use-case.

Really? Was it only for Jinja2? I think FastAPI routers are correctly implemented and typed but I loved this idea; return HTML if its an HTMX request, otherwise just JSON or nothing...

This sounds pretty damn good! I can easily use template engines with my existing routes... This is good!

volfpeter commented 10 months ago

Apart from my comments above, I'd only like to ask one more thing: could you please add a Contributors section to the end of the README (and docs/index.md) and add your name and GitHub profile link to it? Thank you :slightly_smiling_face:

hasansezertasan commented 10 months ago

Apart from my comments above, I'd only like to ask one more thing: could you please add a Contributors section to the end of the README (and docs/index.md) and add your name and GitHub profile link to it? Thank you 🙂

You're most welcome 🙏, I'll check it ASAP. I left a couple of notes for your review comments (I hope I don't seem like a contrarian). Looking forward to hearing your thoughts.

volfpeter commented 10 months ago

Thanks a lot for your work!