FastAPI Python framework - Returning HTML templates (with HTMX integration)
In this video, we look at how to return HTML templates with the FastAPI web framework in Python. We will use Jinja2 templates, and will set our FastAPI function up to return a template response.
We’ll also look at how to integrate with the HTMX library, allowing us to easily utilise dynamic data loading in our FastAPI application.
We will also apply some very basic styles to our page using TailwindCSS.
▶️ Full Playlist:
📌 𝗖𝗵𝗮𝗽𝘁𝗲𝗿𝘀:
00:00 Intro
00:31 Setup
02:56 Creating FastAPI route
05:28 Adding HTMX and TailwindCSS
06:26 Displaying data in HTML table
07:52 Returning data from FastAPI route
09:26 Adding HTMX attributes to button
12:17 FastAPI headers
14:33 Adding hx-swap attribute
☕️ 𝗕𝘂𝘆 𝗺𝗲 𝗮 𝗰𝗼𝗳x