Instruction file imported from perrydrums/thisvid-search (
.cursor/rules/netlify-functions.mdc). Copyright stays with the author.
functions/ (Netlify)
- Handlers use
exports.handlerand CommonJS (require). Keep response JSON shapes stable for the React app (success,videos, etc.). - Cheerio selectors mirror ThisVid’s HTML — fragile. If you change selectors in
videos.js, check pagination / category parsing in the client (useSearchLogic,getCategories.ts) for the same DOM changes. - New HTTP endpoints need both
netlify.tomlredirects andsrc/setupProxy.jsproxy routes for local parity (seedocs/backend-functions.md). - Do not log secrets. Fetch only what the feature needs; heavy parallel scraping belongs behind existing batch patterns (
Promise.allin client, paginated logic in friends).