7 forwardedHeaders.delete("host");
8
9 const res = await fetch(targetUrl, {
10 method: req.method,
11 headers: forwardedHeaders,
12
13async function getWeather(latitude: number, longitude: number): Promise<WeatherData> {
14 console.log(`[getWeather] Fetching weather for lat: ${latitude}, lon: ${longitude}`);
15 const url =
16 `https://api.open-meteo.com/v1/forecast?latitude=${latitude}&longitude=${longitude}¤t=temperature_2m,wind_speed_10m&hourly=temperature_2m,relative_humidity_2m,wind_speed_10m`;
17 console.log(`[getWeather] URL: ${url}`);
18
19 const response = await fetch(url);
20 console.log(`[getWeather] Response status: ${response.status}`);
21
37 console.log(`[getCoordinates] Using corsproxy.io`);
38
39 const response = await fetch(proxyUrl, {
40 headers: {
41 "User-Agent": "WeatherApp/1.0",
68 };
69 } catch (error) {
70 console.error(`[getCoordinates] Error fetching coordinates:`, error);
71 return {
72 latitude: 0,
80 const OPENAI_API_KEY = Deno.env.get("OPENAI_API_KEY");
81
82 const response = await fetch("https://openrouter.ai/api/v1/chat/completions", {
83 method: "POST",
84 headers: {
307
308 try {
309 const response = await fetch('/api/weather', {
310 method: 'POST',
311 headers: {
36 }
37
38 await fetch(`https://api.telegram.org/bot${BOT_TOKEN}/sendMessage`, {
39 method: "POST",
40 headers: { "Content-Type": "application/json" },
154 formData.append('client_secret', clientSecret);
155
156 const response = await fetch(url, {
157 method: 'POST',
158 headers: {
195 };
196
197 const response = await fetch(url, {
198 method: 'POST',
199 headers,
21});
22
23// HTTP vals expect an exported "fetch handler"
24// This is how you "run the server" in Val Town with Hono
25export default app.fetch;
63 }
64 async getCount() {
65 const t = await fetch(this.href, {
66 headers: { Accept: "application/json" },
67 });
80 if (this.hasReacted()) return this.setReacted();
81 this.setAttribute("aria-busy", "true"),
82 await fetch(this.href, {
83 method: "post",
84 body: this.emoji,
210});
211
212export default app.fetch;
52 setResults([]);
53 try {
54 const response = await fetch("http://localhost:3000/search", {
55 method: "POST",
56 headers: { "Content-Type": "application/json" },
13const app = new Hono();
14app.get("/", ObservationsEnjoyExisting);
15export default app.fetch;
314
315 try {
316 const response = await fetch(window.location.origin, {
317 method: 'POST',
318 headers: { 'Content-Type': 'application/json' },