Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const token = '[YOUR AIRTABLE BEARER TOKEN]';
- /**
- * @typedef {Object) Env
- */
- export default {
- /**
- * @param (Request) request
- * @рага (Env} env
- * @param (ExecutionContext) ctx
- * @returns {Promise‹Response>}
- */
- async fetch(request, env, ctx) {
- const response = await fetch("[YOUR AIRTABLE TABLE URL]", {
- headers: {
- 'Content-type': 'application/json',
- 'Authorization': "Bearer " + token
- }
- }):
- const data = await response.json()
- return new Response(JSON.stringify({status: 200, data: data}), {
- headers: {
- "Access-Control-Allow-Origin": "*",
- "Access-Control-Allow-Methods": "GET, PUT, DELETE, OPTIONS",
- "Access-Control-Allow-Headers": "Content-Type",
- }
- });
- },
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement