From the course: Building Full-Stack Applications with HTMX
Unlock this course with a free trial
Join today to access over 25,300 courses taught by industry experts.
Developing the search page - HTMX Tutorial
From the course: Building Full-Stack Applications with HTMX
Developing the search page
- [Instructor] Now that we have all the backend infrastructure set up for our search feature, we can now begin building the feature itself. In this video, we'll be developing the backend endpoint that will search our database and return an HTML list of students that match the keyword sent in the search request. We'll also be developing our frontend with HTMX to send search queries to the backend and also display the results. Sounds good? Let's begin. And we'll be starting things at the backend. Our first task is to build up our HTML response that will return our list of search results. The plan is to wrap this process in a function that we can then use in our endpoint to return the results. This function will take our students search results and return them as an HTML fragment. So first, let's create a function with the name render search results and pass it our students argument. You can do that right under our seed function. (keyboard clacking) Let me scroll up a little bit. Render…