Add pagination: Next/Prev buttons, offset support across proxy & Netlify function

This commit is contained in:
blazblue547-afk committed 2026-06-13 18:21:55 -04:00
1 parent 4c63fa5b8b
commit 6428b51d01
3 files changed
+296 -57

No files matched your search

+2 -1
View File
@@ -23,6 +23,7 @@ exports.handler = async (event) => {
const query = event.queryStringParameters?.q;
const count = event.queryStringParameters?.count || "12";
const offset = event.queryStringParameters?.offset || "0";
if (!query) {
return {
@@ -41,7 +42,7 @@ exports.handler = async (event) => {
};
}
const braveUrl = `https://api.search.brave.com/res/v1/web/search?q=${encodeURIComponent(query)}&count=${count}`;
const braveUrl = `https://api.search.brave.com/res/v1/web/search?q=${encodeURIComponent(query)}&count=${count}&offset=${offset}`;
try {
// Node 18+ has global fetch built in