27 try {
28 // First API call - Get search results
29 const searchResult = await fetch("/api/search", {
30 method: "POST",
31 headers: { "Content-Type": "application/json" },
38 // Second API call - Get summary
39 setSummaryLoading(true);
40 const summaryResult = await fetch("/api/summarize", {
41 method: "POST",
42 headers: { "Content-Type": "application/json" },
149 // Search using SerpApi
150 try {
151 const searchResponse = await fetch(
152 `https://serpapi.com/search.json?q=${encodeURIComponent(query)}&api_key=${Deno.env.get("SERP_API_KEY")}`,
153 );
143
144 // send the request to openai
145 const response = await fetch(openaiUrl, {
146 method: "POST",
147 body: JSON.stringify(body),
20
21 try {
22 const response = await fetch("/chat", {
23 method: "POST",
24 body: JSON.stringify({ messages: newMessages }),
187
188 try {
189 const response = await fetch("/", {
190 method: "POST",
191 body: JSON.stringify({
143
144 // send the request to openai
145 const response = await fetch(openaiUrl, {
146 method: "POST",
147 body: JSON.stringify(body),
29 setStatus(`Processing payment via ${method}...`);
30 try {
31 const response = await fetch("/process-payment", {
32 method: "POST",
33 headers: { "Content-Type": "application/json" },
29 setStatus(`Processing payment via ${method}...`);
30 try {
31 const response = await fetch("/process-payment", {
32 method: "POST",
33 headers: { "Content-Type": "application/json" },
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export async function postHogAPICapture({ key, event, properties, distinct_id }: {
13 "distinct_id": distinct_id,
14 };
15 let result = await fetch("https://app.posthog.com/capture/", {
16 method: "POST",
17 headers: {
1# Framer Fetch: Basic
2
3A basic example of an API endpoint to use with Framer Fetch.
132app.get('/main.js', serve(js, 'text/javascript'));
133app.get('/polypng.mjs', async (c) => {
134 const res = await fetch('https://gist.githubusercontent.com/autowert66/e6371d2cf5fd365d57668f8399ec02ca/raw/polypng.mjs');
135 return new Response(res.body, { headers: { 'Content-Type': 'text/javascript' } });
136});
137
138export default app.fetch;