getWeathermain.tsx2 matches
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
23export async function getWeather(location: string): Promise<WeatherResponse> {
4return fetchJSON(`https://wttr.in/${location}?format=j1`);
5}
6
weatherGPTmain.tsx1 match
4let location = "munchen";
5let lang = "en";
6const weather = await fetch(
7`https://wttr.in/${location}?lang=${lang}&format=j1`,
8).then(r => r.json());
scraper_templatemain.tsx1 match
9const variable: string = await blob.getJSON(blobKey) ?? "";
1011const response = await fetch(scrapeURL);
12const body = await response.text();
13const $ = cheerio.load(body);
get_gemini_modelsmain.tsx2 matches
11const API_KEY = process.env.GEMINI_API_KEY;
1213const response = await fetch(`https://generativelanguage.googleapis.com/v1beta/models?key=${API_KEY}`);
1415const data = await response.json();
22return models;
23} catch (error) {
24console.error("Error fetching Gemini models:", error);
25return [];
26}
sqliteExplorerAppmain.tsx4 matches
1/** @jsxImportSource https://esm.sh/hono@latest/jsx **/
23import { modifyFetchHandler } from "https://esm.town/v/andreterron/codeOnValTown?v=50";
4import { iframeHandler } from "https://esm.town/v/nbbaier/iframeHandler";
5import { resetStyle } from "https://esm.town/v/nbbaier/resetStyle";
16import { verifyToken } from "https://esm.town/v/pomdtr/verifyToken";
17import { ResultSet, sqlite } from "https://esm.town/v/std/sqlite";
18import { reloadOnSaveFetchMiddleware } from "https://esm.town/v/stevekrouse/reloadOnSave";
19import { Hono } from "npm:hono";
20import type { FC } from "npm:hono/jsx";
175});
176177export const handler = app.fetch;
178export default iframeHandler(modifyFetchHandler(passwordAuth(handler, { verifyPassword: verifyToken })));
16});
1718fetch(url, {
19method: "POST",
20headers: headers,
39}, [selectedLocation]);
4041const fetchSuggestions = async (input) => {
42if (suggestionCache.current[input]) {
43setSuggestions(suggestionCache.current[input]);
47setIsLoading(true);
48try {
49const response = await fetch("/geocode", {
50method: "POST",
51headers: { "Content-Type": "application/json" },
52body: JSON.stringify({ query: input }),
53});
54if (!response.ok) throw new Error("Failed to fetch suggestions");
55const data = await response.json();
56setSuggestions(data);
57suggestionCache.current[input] = data;
58} catch (error) {
59console.error("Error fetching suggestions:", error);
60setSuggestions([]);
61} finally {
64};
6566const debouncedFetchSuggestions = useRef(
67debounce(fetchSuggestions, 300)
68).current;
6970useEffect(() => {
71if (query.length > 2) {
72debouncedFetchSuggestions(query);
73} else {
74setSuggestions([]);
128129try {
130const response = await fetch("https://api.cerebras.ai/v1/chat/completions", {
131method: "POST",
132headers: {
146147if (!response.ok) {
148throw new Error("Failed to fetch from Cerebras API");
149}
150158} catch (error) {
159console.error("Error calling Cerebras API:", error);
160return new Response(JSON.stringify({ error: "Failed to fetch suggestions" }), {
161status: 500,
162headers: { "Content-Type": "application/json" },
whoIsHiringmain.tsx12 matches
61}, [state.loading, state.hasMore]);
6263const fetchStories = async () => {
64try {
65const response = await fetch("/api/stories");
66if (!response.ok) throw new Error("Failed to fetch dates");
67const data = await response.json();
68setStories(data);
70}
71catch (err) {
72console.error("Error fetching stories:", err);
73}
74};
7576const fetchComments = async (query: string, story: string, page: number) => {
77try {
78dispatch({ type: "loading", value: true });
79const response = await fetch(`/api/comments?query=${encodeURIComponent(query)}&story=${story}&page=${page}`);
80if (!response.ok) throw new Error("Failed to fetch comments");
81const data = await response.json();
82setComments(prevComments => page === 1 ? data.hits : [...prevComments, ...data.hits]);
84dispatch({ type: "loading", value: false });
85} catch (err) {
86console.error("Error fetching comments:", err);
87dispatch({ type: "loading", value: false });
88}
99dispatch({ type: "hasMore", value: true });
100dispatch({ type: "query", value: newQuery });
101fetchComments(fullQuery, state.story, 1);
102};
103104useEffect(() => {
105fetchStories();
106107const handleScroll = () => {
122: "";
123const fullQuery = `${filtersQuery} ${state.query}`;
124fetchComments(fullQuery, state.story, state.page);
125}
126}
391tags: `comment, story_${story}`,
392page: 0,
393hitsPerPage: 100, // Fetch a moderate number of comments
394});
395
sqliteExplorerAppmain.tsx1 match
21
22try {
23const response = await fetch(window.location.href, {
24method: 'POST',
25headers: {