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.

Displaying some articles

Displaying some articles

- [Instructor] So now that we have successfully seeded our database with hundreds of articles, we can begin building the infinite scroll feature. In this video, we'll be developing the backend endpoint that will return a subset of 12 articles based on the specified record window. This will be returned as HTML displaying article titles and their timestamps. We'll also be developing our front end with HTMX to request more articles from the backend when the scroll bar hits the base of the page. So let's begin. I'll start things off at the backend. The first task on our list is to build up our HTML response that will return our article results. We'll be wrapping this HTML response generation process in a function that we can then use in our endpoint to return the results. The function will take in a product set from our database query and return them as an HTML fragment. So first, let's create a function with the name render results, and pass it a posts argument. This posts argument…

Contents