Closed matheusgomes28 closed 7 months ago
Hi. I understood the issue and Here’s a proposed solution:
So I think, I can handle it.
@Ali-Assar Sounds like a solid plan mate!
That's along the lines of what I was thinking about. Feel free to send the PR my way whenever you have time to complete it, happy to review it with you 😆
I think that usually, websites have like a URL parameter to indicate which page it is, then you can deduce what limit
and offset
value you want to serve.
for more info on this for gin, take a look at the query parameters documentation.
To add some stuff to your plan:
/page/:num
request/
so you can reuse in the other page/:num
handlers. If you think about it, the index is just /page/0
or something.downside is that there is a cache on top of the /
handler, but let me know if you are struggling because I can come in and help. For now, if you just want to add a separate handler for /page/:num
, that would be great
Closed with #50
Add support for pagination in posts returned from
db.GetPosts(...)
. This way, we can make the number of displayed posts in the index page configurable.This can be achieved quite easily by adding
LIMIT
andOFFSET
to the query, but we would need to capture the current offset in perhaps a GETurl
parameter.