Identify growth opportunities and fix gaps with a detailed analysis tailored to your business. Our Snapshot Report highlights key insights to boost leads, improve your website, and automate marketing.
// worker.js
const VEND_API_BASE = 'https://api.your-vendasta-endpoint.com/v1/feeds';
const FEED_ID = 'CCA-C2F65B83B82249A5B34FC98A6C091BC2'; // <- your feed id
const API_KEY = 'YOUR_SECRET_API_KEY'; // keep server-side only
export default {
async fetch(request) {
if (request.method !== 'GET') {
return new Response('Method Not Allowed', { status: 405 });
}
// Example: first 10 posts; tweak params to match Vendasta API
const url = `${VEND_API_BASE}/${FEED_ID}/posts?limit=10`;
const upstream = await fetch(url, {
headers: {
'Authorization': `Bearer ${API_KEY}`,
'Accept': 'application/json'
}
});
const body = await upstream.text();
return new Response(body, {
status: upstream.status,
headers: {
'Content-Type': 'application/json',
'Access-Control-Allow-Origin': '*',
'Cache-Control': 'public, max-age=300'
}
});
}
};