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 })));
25visited.add(url);
2627const response = await fetch(url);
28const html = await response.text();
29const $ = cheerio.load(html);
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 })));
lucia_demomain.tsx1 match
233});
234235export default app.fetch;
hackerNewsDigestmain.tsx8 matches
3import { email } from "https://esm.town/v/std/email";
45async function fetchStories(type: string, count: number) {
6const response = await fetch(`https://hacker-news.firebaseio.com/v0/${type}stories.json`);
7const storyIds = await response.json();
8const stories = await Promise.all(
9storyIds.slice(0, count).map(async (id: number) => {
10const storyResponse = await fetch(`https://hacker-news.firebaseio.com/v0/item/${id}.json`);
11return storyResponse.json();
12}),
120export default async function server(req: Request) {
121try {
122const topStories = await fetchStories("top", 20);
123const newStories = await fetchStories("new", 5);
124const showStories = await fetchStories("show", 3);
125const askStories = await fetchStories("ask", 3);
126const jobStories = await fetchStories("job", 3);
127128const emailContent = createEmailContent(topStories, newStories, showStories, askStories, jobStories);
theHereTimesmain.tsx18 matches
2* This application creates "The Here Times", a map-based news aggregator.
3* It uses the Google Maps JavaScript API for map rendering, Geonames for location data,
4* and the NewsAPI for fetching news articles.
5* The app displays news for the top 12 most populous cities/neighborhoods in the current map view.
6*
8* 1. Use Google Maps JavaScript API for rendering the map
9* 2. Use Geonames API to get top 12 most populous cities within the map bounds
10* 3. Fetch news data from NewsAPI based on these locations
11* 4. Display news articles in a side drawer, only showing articles that contain the city's name in the title
12* 5. Place markers on the map for each location (exactly 12)
37const initMap = async () => {
38try {
39const response = await fetch("/api/maps-key");
40const { apiKey } = await response.json();
4195const sw = bounds.getSouthWest();
9697await fetchLocationsAndNews(sw.lat(), sw.lng(), ne.lat(), ne.lng());
98});
99} catch (error) {
113}, [map, locations, googleMaps]);
114115const fetchLocationsAndNews = async (south, west, north, east) => {
116try {
117const locationResponse = await fetch(`/api/locations?south=${south}&west=${west}&north=${north}&east=${east}`);
118if (!locationResponse.ok) {
119throw new Error(`HTTP error! status: ${locationResponse.status}`);
120}
121const fetchedLocations = await locationResponse.json();
122console.log("Fetched locations:", fetchedLocations.length);
123const limitedLocations = fetchedLocations.slice(0, 12);
124setLocations(limitedLocations);
125console.log("Set locations:", limitedLocations.length);
126127const newsPromises = limitedLocations.map(location =>
128fetch(`/api/news?location=${encodeURIComponent(location.name)}`)
129.then(async response => {
130if (!response.ok) {
147setError(null);
148} catch (error) {
149console.error("Error fetching locations and news:", error);
150setError(`Failed to fetch news: ${error.message}. Please try again later.`);
151setNews([]);
152setLocations([]);
295296try {
297const response = await fetch(geonamesUrl);
298if (!response.ok) {
299throw new Error(`Geonames API responded with status: ${response.status}`);
301const data = await response.json();
302if (data.geonames && Array.isArray(data.geonames)) {
303console.log("Server: Fetched locations:", data.geonames.length);
304return new Response(JSON.stringify(data.geonames.slice(0, 12)), {
305headers: { "Content-Type": "application/json" },
309}
310} catch (error) {
311console.error("Error fetching location data:", error);
312return new Response(JSON.stringify({ error: error.message }), {
313status: 500,
335}
336337console.log(`Fetching news for ${location} from ${apiUrl}`);
338339const response = await fetch(apiUrl);
340341if (!response.ok) {
372}));
373374console.log(`Server: Fetched news for ${location}:`, newsData.length);
375return new Response(JSON.stringify(newsData), {
376headers: { "Content-Type": "application/json" },
infoboxCrawlermain.tsx1 match
26visited.add(url);
2728const response = await fetch(url);
29const html = await response.text();
30const $ = cheerio.load(html);
hackerNewsDigestmain.tsx8 matches
3import { email } from "https://esm.town/v/std/email";
45async function fetchStories(type: string, count: number) {
6const response = await fetch(`https://hacker-news.firebaseio.com/v0/${type}stories.json`);
7const storyIds = await response.json();
8const stories = await Promise.all(
9storyIds.slice(0, count).map(async (id: number) => {
10const storyResponse = await fetch(`https://hacker-news.firebaseio.com/v0/item/${id}.json`);
11return storyResponse.json();
12}),
120export default async function server(req: Request) {
121try {
122const topStories = await fetchStories("top", 10);
123const newStories = await fetchStories("new", 5);
124const showStories = await fetchStories("show", 3);
125const askStories = await fetchStories("ask", 3);
126const jobStories = await fetchStories("job", 3);
127128const emailContent = createEmailContent(topStories, newStories, showStories, askStories, jobStories);
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 })));
infoboxCrawlermain.tsx1 match
24visited.add(url);
2526const response = await fetch(url);
27const html = await response.text();
28const $ = cheerio.load(html);