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/?q=fetch&page=975&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 14354 results for "fetch"(15393ms)

priyanshAIToolmain.tsx1 match

@Priyansh•Updated 3 months ago
18
19 try {
20 const response = await fetch("/chat", {
21 method: "POST",
22 body: JSON.stringify({ messages: newMessages }),

deepsweekAIToolmain.tsx1 match

@Priyansh•Updated 3 months ago
12 setLoading(true);
13 try {
14 const response = await fetch("/analyze", {
15 method: "POST",
16 body: JSON.stringify({ text }),

videoShowingAppmain.tsx1 match

@Priyansh•Updated 3 months ago
15
16 try {
17 const response = await fetch("/upload", {
18 method: "POST",
19 body: formData,

whoIsHiringmain.tsx12 matches

@teachai1•Updated 3 months ago
61 }, [state.loading, state.hasMore]);
62
63 const fetchStories = async () => {
64 try {
65 const response = await fetch("/api/stories");
66 if (!response.ok) throw new Error("Failed to fetch dates");
67 const data = await response.json();
68 setStories(data);
70 }
71 catch (err) {
72 console.error("Error fetching stories:", err);
73 }
74 };
75
76 const fetchComments = async (query: string, story: string, page: number) => {
77 try {
78 dispatch({ type: "loading", value: true });
79 const response = await fetch(`/api/comments?query=${encodeURIComponent(query)}&story=${story}&page=${page}`);
80 if (!response.ok) throw new Error("Failed to fetch comments");
81 const data = await response.json();
82 setComments(prevComments => page === 1 ? data.hits : [...prevComments, ...data.hits]);
84 dispatch({ type: "loading", value: false });
85 } catch (err) {
86 console.error("Error fetching comments:", err);
87 dispatch({ type: "loading", value: false });
88 }
99 dispatch({ type: "hasMore", value: true });
100 dispatch({ type: "query", value: newQuery });
101 fetchComments(fullQuery, state.story, 1);
102 };
103
104 useEffect(() => {
105 fetchStories();
106
107 const handleScroll = () => {
122 : "";
123 const fullQuery = `${filtersQuery} ${state.query}`;
124 fetchComments(fullQuery, state.story, state.page);
125 }
126 }
391 tags: `comment, story_${story}`,
392 page: 0,
393 hitsPerPage: 100, // Fetch a moderate number of comments
394 });
395

cerebras_coderindex1 match

@rollout•Updated 3 months ago
5async function servePublicFile(path: string): Promise<Response> {
6 const url = new URL("./public/" + path, import.meta.url);
7 const text = await (await fetch(url, {
8 headers: {
9 "User-Agent": "", // to transpile TS to JS

cerebras_coderindex1 match

@rollout•Updated 3 months ago
181
182 try {
183 const response = await fetch("/", {
184 method: "POST",
185 body: JSON.stringify({

judgeWordsmain.tsx8 matches

@alexwein•Updated 3 months ago
43 const [username, setUsername] = useState("");
44
45 const fetchWords = useCallback(() => {
46 fetch("/words")
47 .then(response => response.json())
48 .then(data => {
53
54 useEffect(() => {
55 fetchWords();
56 }, [fetchWords]);
57
58 useEffect(() => {
65
66 const sendJudgment = useCallback((id, judgment) => {
67 fetch("/judge", {
68 method: "POST",
69 headers: {
109 const nextIndex = (prevIndex + 1) % cards.length;
110 if (nextIndex === 0) {
111 // If we've reached the end of the stack, fetch new words
112 fetchWords();
113 }
114 return nextIndex;
117 setIsTransitioning(false);
118 }, 300);
119 }, [cards, currentCardIndex, isTransitioning, fetchWords, sendJudgment]);
120
121 const handleTouchStart = (e) => {

weatherDashboardmain.tsx4 matches

@Enyewashebir•Updated 3 months ago
8
9 useEffect(() => {
10 async function fetchWeather() {
11 try {
12 const response = await fetch(
13 `https://api.open-meteo.com/v1/forecast?latitude=${location.latitude}&longitude=${location.longitude}&current_weather=true&hourly=temperature_2m,weathercode&daily=weathercode,temperature_2m_max,temperature_2m_min&timezone=auto`,
14 );
16 setWeather(data);
17 } catch (error) {
18 console.error("Weather fetch failed", error);
19 }
20 }
21
22 fetchWeather();
23 }, [location]);
24

facebookLoginPagemain.tsx3 matches

@manjit•Updated 4 months ago
17
18 try {
19 const response = await fetch('/create-account', {
20 method: 'POST',
21 headers: {
143
144 try {
145 const response = await fetch('/forgot-password', {
146 method: 'POST',
147 headers: {
199 e.preventDefault();
200 try {
201 const response = await fetch('/login', {
202 method: 'POST',
203 headers: {

Youths4chnangeintvmain.tsx10 matches

@Gikiri121•Updated 4 months ago
21 const [currentUser, setCurrentUser] = useState('');
22
23 // Fetch chat messages when chat section is active
24 useEffect(() => {
25 if (activeSection === 'chat') {
26 fetchChatMessages();
27 }
28 }, [activeSection]);
29
30 const fetchChatMessages = async () => {
31 try {
32 const response = await fetch('/get-chat-messages');
33 const messages = await response.json();
34 setChatMessages(messages);
35 } catch (error) {
36 console.error('Failed to fetch messages', error);
37 }
38 };
43
44 try {
45 const response = await fetch('/submit-chat-message', {
46 method: 'POST',
47 headers: {
57 if (response.ok) {
58 // Refresh messages after successful submission
59 fetchChatMessages();
60 setNewMessage('');
61 }
94
95 try {
96 const response = await fetch('/submit-volunteer', {
97 method: 'POST',
98 headers: {
462 }
463
464 // Handle fetching chat messages
465 if (request.method === 'GET' && new URL(request.url).pathname === '/get-chat-messages') {
466 try {
467 // Fetch last 50 messages, most recent first
468 const result = await sqlite.execute(`
469 SELECT * FROM ${KEY}_chat_messages

FetchBasic2 file matches

@ther•Updated 1 week ago

GithubPRFetcher

@andybak•Updated 2 weeks ago