Val Town Code SearchReturn to Val Town

API Access

You can access search results via JSON API by adding format=json to your query:

https://codesearch.val.run/$%7BsvgDataUrl%7D?q=fetch&page=3&format=json

For typeahead suggestions, use the /typeahead endpoint:

https://codesearch.val.run/typeahead?q=fetch

Returns an array of strings in format "username" or "username/projectName"

Found 14071 results for "fetch"(3030ms)

tanstackReactHonoExamplequeries.ts5 matches

@neverstew•Updated 7 hours ago
2import { type Message } from "../../shared/utils.ts";
3
4// Fetch messages query
5export function useMessages(initialData?: Message[]) {
6 return useQuery({
7 queryKey: ["messages"],
8 queryFn: async () => {
9 const response = await fetch("/api/messages");
10 if (!response.ok) {
11 throw new Error("Failed to fetch messages");
12 }
13 const data = await response.json();
25 return useMutation({
26 mutationFn: async (content: string) => {
27 const response = await fetch("/api/messages", {
28 method: "POST",
29 headers: { "Content-Type": "application/json" },
38 },
39 onSuccess: () => {
40 // Invalidate and refetch messages
41 queryClient.invalidateQueries({ queryKey: ["messages"] });
42 },

Todomain.tsx3 matches

@svc•Updated 9 hours ago
253 addMessageToChat('ai', 'Aura is thinking...');
254 try {
255 const res = await fetch(\`\${API_URL}?action=chat\`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ message: userMessage, tasks, projects, history: conversationHistory.slice(-4) }) });
256 if (!res.ok) {
257 const err = await res.json();
284 toggleLoading(btn, true);
285 try {
286 const res = await fetch(\`\${API_URL}?action=synthesizeProject\`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ goal }) });
287 if (!res.ok) {
288 const err = await res.json();
317 toggleLoading(btn, true);
318 try {
319 const res = await fetch(\`\${API_URL}?action=getDailyReschedule\`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ tasks: todayTasks }) });
320 if (!res.ok) {
321 const err = await res.json();

cardamonRecipeForm.tsx2 matches

@connnolly•Updated 10 hours ago
123 }
124
125 const response = await fetch(endpoint, {
126 method: 'POST',
127 headers: { 'Content-Type': 'application/json' },
201 const method = isEditing ? 'PUT' : 'POST';
202
203 const response = await fetch(url, {
204 method,
205 headers: { 'Content-Type': 'application/json' },

brokenLinkCrawlercheckLink.tsx1 match

@willthereader•Updated 10 hours ago
1export async function checkLink(link) {
2 const linksMetaData = await fetch(link, {
3 method: "HEAD",
4 headers: {

cardamonindex.ts1 match

@connnolly•Updated 10 hours ago
100
101// This is the entry point for HTTP vals
102export default app.fetch;

brokenLinkCrawlerurlGetter.tsx1 match

@willthereader•Updated 11 hours ago
1export async function urlGetter(sourceURl) {
2 const response = await fetch(sourceURl);
3 const html = await response.text();
4 const matches = [...html.matchAll(/<a[^>]*href="([^"]+)"[^>]*>(.*?)<\/a>/g)].map((match) => match[1]);

cardamonRecipeView.tsx1 match

@connnolly•Updated 11 hours ago
34 const handleDelete = async () => {
35 try {
36 const response = await fetch(`/api/recipes/${recipe.id}`, {
37 method: 'DELETE'
38 });

cardamonRecipeList.tsx1 match

@connnolly•Updated 11 hours ago
48 const handleDelete = async (recipeId: number) => {
49 try {
50 const response = await fetch(`/api/recipes/${recipeId}`, {
51 method: 'DELETE'
52 });

cardamonApp.tsx1 match

@connnolly•Updated 11 hours ago
33 setState(prev => ({ ...prev, loading: true, error: null }));
34 try {
35 const response = await fetch('/api/recipes');
36 const data = await response.json();
37

cardamonrecipes.ts4 matches

@connnolly•Updated 11 hours ago
30 return c.json({ success: true, data: recipes } as ApiResponse<Recipe[]>);
31 } catch (error) {
32 console.error('Error fetching recipes:', error);
33 return c.json({ success: false, error: 'Failed to fetch recipes' } as ApiResponse, 500);
34 }
35});
50 return c.json({ success: true, data: recipe } as ApiResponse<Recipe>);
51 } catch (error) {
52 console.error('Error fetching recipe:', error);
53 return c.json({ success: false, error: 'Failed to fetch recipe' } as ApiResponse, 500);
54 }
55});

FetchBasic2 file matches

@ther•Updated 6 days ago

GithubPRFetcher

@andybak•Updated 1 week ago