TownieMessages.tsx9 matches
256</>
257);
258case "fetch":
259return (
260<Details
269summary={(
270<>
271<div>fetch:</div>
272<div>{args?.valPath}</div>
273<div>{args?.urlPath || "/"}</div>
275)}>
276{result?.type === "success" ? (
277<div className="fetch-result">
278<div className="fetch-header">
279<span className={`status-badge ${result.data.status >= 200 && result.data.status < 300 ? 'success' :
280result.data.status >= 300 && result.data.status < 400 ? 'redirect' :
284<span className="response-time">{result.data.responseTime}ms</span>
285</div>
286<div className="fetch-section">
287<h4>Headers</h4>
288<pre className="fetch-headers">{JSON.stringify(result.data.headers, null, 2)}</pre>
289</div>
290<div className="fetch-section">
291<h4>Response Body</h4>
292<pre className="fetch-body">
293{typeof result.data.body === 'object'
294? JSON.stringify(result.data.body, null, 2)
298</div>
299) : (
300<div className="fetch-error">
301<h4>Error</h4>
302<pre>{result?.message || "Unknown error"}</pre>
untitled-2285main.tsx1 match
7});
89export default app.fetch;
18const start = performance.now();
19try {
20res = await fetch(url);
21end = performance.now();
22status = res.status;
28} catch (e) {
29end = performance.now();
30reason = `couldn't fetch: ${e}`;
31ok = false;
32}
kebede-and-ben-testApp.tsx2 matches
16
17try {
18const response = await fetch('/api/game', {
19method: 'POST',
20headers: {
47const moveData: MoveRequest = { position };
48
49const response = await fetch(`/api/game/${game.id}/move`, {
50method: 'PUT',
51headers: {
kebede-and-ben-testindex.ts1 match
27});
2829export default app.fetch;
1import { fetch } from "https://esm.town/v/std/fetch";
23// Send a pushover message.
10console.log("Tokens:", { PUSHOVER_TOKEN, PUSHOVER_USER_KEY }); // Check if env vars are set
1112const response = await fetch("https://api.pushover.net/1/messages.json", {
13method: "POST",
14headers: {
stravachatsendDailyBrief.ts1 match
135const lastSunday = today.startOf("week").minus({ days: 1 });
136137// Fetch relevant memories using the utility function
138const memories = await getRelevantMemories();
139
stravachatNotebookView.tsx12 matches
67const [currentPage, setCurrentPage] = useState(1);
6869const fetchMemories = useCallback(async () => {
70setLoading(true);
71setError(null);
72try {
73const response = await fetch(API_BASE);
74if (!response.ok) {
75throw new Error(`HTTP error! status: ${response.status}`);
78setMemories(data);
79} catch (e) {
80console.error("Failed to fetch memories:", e);
81setError(e.message || "Failed to fetch memories.");
82} finally {
83setLoading(false);
8687useEffect(() => {
88fetchMemories();
89}, [fetchMemories]);
9091const handleAddMemory = async (e: React.FormEvent) => {
100101try {
102const response = await fetch(API_BASE, {
103method: "POST",
104headers: { "Content-Type": "application/json" },
112setNewMemoryTags("");
113setShowAddForm(false);
114await fetchMemories();
115} catch (e) {
116console.error("Failed to add memory:", e);
123124try {
125const response = await fetch(`${API_BASE}/${id}`, {
126method: "DELETE",
127});
129throw new Error(`HTTP error! status: ${response.status}`);
130}
131await fetchMemories();
132} catch (e) {
133console.error("Failed to delete memory:", e);
155156try {
157const response = await fetch(`${API_BASE}/${editingMemory.id}`, {
158method: "PUT",
159headers: { "Content-Type": "application/json" },
164}
165setEditingMemory(null);
166await fetchMemories();
167} catch (e) {
168console.error("Failed to update memory:", e);
stravachatindex.ts2 matches
135));
136137// HTTP vals expect an exported "fetch handler"
138export default app.fetch;
stravachat.cursorrules5 matches
163```
1641655. **fetchTranspiledJavaScript** - Fetch and transpile TypeScript to JavaScript:
166```ts
167const jsCode = await fetchTranspiledJavaScript("https://esm.town/v/username/project/path/to/file.ts");
168```
169242243// Inject data to avoid extra round-trips
244const initialData = await fetchInitialData();
245const dataScript = `<script>
246window.__INITIAL_DATA__ = ${JSON.stringify(initialData)};
3003015. **API Design:**
302- `fetch` handler is the entry point for HTTP vals
303- Run the Hono app with `export default app.fetch // This is the entry point for HTTP vals`
304- Properly handle CORS if needed for external access