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/$%7Bsuccess?q=fetch&page=949&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 13861 results for "fetch"(6303ms)

cerebras_codermain.tsx1 match

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

reactRouter7server.tsx1 match

@charmaine•Updated 4 months ago
5 if (url.pathname == "/js/entry.client.js") {
6 const moduleUrl = new URL("./entry.client.tsx", import.meta.url);
7 return fetch(moduleUrl);
8 }
9 return handler(request);

reactRouter7layout.client.ts2 matches

@charmaine•Updated 4 months ago
3export async function loader({ request }: LoaderFunctionArgs) {
4 let url = new URL(request.url);
5 let res = await fetch(url, {
6 headers: {
7 Accept: "application/json",
15 let url = new URL(request.url);
16 // call the server action
17 let res = await fetch(url, {
18 method: "POST",
19 body: new URLSearchParams(await request.formData()),

OpenAImain.tsx1 match

@Yogareddy107•Updated 4 months ago
12 * @param {number} [opts.timeout=10 minutes] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
13 * @param {number} [opts.httpAgent] - An HTTP agent used to manage HTTP(s) connections.
14 * @param {Core.Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
15 * @param {number} [opts.maxRetries=2] - The maximum number of times the client will retry a request.
16 * @param {Core.Headers} opts.defaultHeaders - Default headers to include with every request to the API.

YoutubeSearchAppmain.tsx2 matches

@aazad•Updated 4 months ago
23 e.preventDefault();
24 try {
25 const response = await fetch(`/search?q=${encodeURIComponent(searchQuery)}`);
26 const data = await response.json();
27
43
44 try {
45 const response = await fetch("/save-video", {
46 method: "POST",
47 headers: {

gitHubSyncmain.tsx3 matches

@charmaine•Updated 4 months ago
82 if (!code) return c.text("No code provided", 400);
83
84 const tokenResponse = await fetch("https://github.com/login/oauth/access_token", {
85 method: "POST",
86 headers: {
97 const { access_token } = await tokenResponse.json();
98
99 const userResponse = await fetch("https://api.github.com/user", {
100 headers: {
101 "Authorization": `token ${access_token}`,
302}
303
304export default app.fetch;
305
306interface CommitOptions {

wordRangeFindermain.tsx2 matches

@jrunning•Updated 4 months ago
10
11 useEffect(() => {
12 fetch('/words')
13 .then(response => response.json())
14 .then(data => setWords(data));
77
78 if (url.pathname === '/words') {
79 const corpusResponse = await fetch('https://gist.githubusercontent.com/daemondevin/df09befaf533c380743bc2c378863f0c/raw/b79b0628e79766326cdd61cc52a7222b8e5ad49a/5-letter-words.txt');
80 const corpusText = await corpusResponse.text();
81 const words = corpusText.split('\n').filter(word => word.trim().length === 5);

YouTubeSaveAppmain.tsx15 matches

@aazad•Updated 4 months ago
30 const checkLoginStatus = async () => {
31 try {
32 const response = await fetch('/check-login');
33 const data = await response.json();
34 if (data.loggedIn) {
35 setUser(data.user);
36 fetchSavedVideos();
37 }
38 } catch (err) {
43 const searchVideos = async () => {
44 try {
45 const response = await fetch(`/search?q=${encodeURIComponent(query)}`);
46 const data = await response.json();
47 setVideos(data.items || []);
48 setError(null);
49 } catch (err) {
50 setError("Failed to fetch videos");
51 setVideos([]);
52 }
56 e.preventDefault();
57 try {
58 const response = await fetch('/login', {
59 method: 'POST',
60 headers: { 'Content-Type': 'application/json' },
65 setUser(data.user);
66 setView('search');
67 fetchSavedVideos();
68 } else {
69 setError(data.message);
77 e.preventDefault();
78 try {
79 const response = await fetch('/register', {
80 method: 'POST',
81 headers: { 'Content-Type': 'application/json' },
96 const logout = async () => {
97 try {
98 await fetch('/logout', { method: 'POST' });
99 setUser(null);
100 setView('login');
106 const saveVideo = async (video) => {
107 try {
108 const response = await fetch('/save-video', {
109 method: 'POST',
110 headers: { 'Content-Type': 'application/json' },
113 const data = await response.json();
114 if (data.success) {
115 fetchSavedVideos();
116 }
117 } catch (err) {
120 };
121
122 const fetchSavedVideos = async () => {
123 try {
124 const response = await fetch('/saved-videos');
125 const data = await response.json();
126 setSavedVideos(data.videos || []);
127 } catch (err) {
128 setError("Failed to fetch saved videos");
129 }
130 };
421 }
422
423 // Fetch Saved Videos
424 if (url.pathname === '/saved-videos') {
425 // Note: This is a mock implementation. In a real app, you'd get the user ID from a session
449
450 try {
451 const apiResponse = await fetch(
452 `https://youtube.googleapis.com/youtube/v3/search?part=snippet&maxResults=12&q=${encodeURIComponent(query)}&type=video&key=AIzaSyA6J525ONAprqQ2yJcjir6NiqlB8mLzMls`
453 );

instamain.tsx7 matches

@aazad•Updated 4 months ago
11
12 useEffect(() => {
13 fetch("/api/posts")
14 .then(res => res.json())
15 .then(setPosts);
16
17 fetch("/api/me")
18 .then(res => res.json())
19 .then(setUser);
38 formData.append("caption", postCaption);
39
40 const response = await fetch("/api/posts", {
41 method: "POST",
42 body: formData,
52
53 const likePost = async (postId) => {
54 const response = await fetch(`/api/posts/${postId}/like`, { method: "POST" });
55 const updatedPost = await response.json();
56 setPosts(posts.map(post => post.id === postId ? updatedPost : post));
58
59 const login = async (username, password) => {
60 const response = await fetch("/api/login", {
61 method: "POST",
62 body: JSON.stringify({ username, password }),
67
68 const logout = async () => {
69 await fetch("/api/logout", { method: "POST" });
70 setUser(null);
71 };
248 }
249
250 // Fetch posts endpoint
251 if (url.pathname === "/api/posts" && request.method === "GET") {
252 const posts = await sqlite.execute(`

verseOfTheDayAppmain.tsx7 matches

@aazad•Updated 4 months ago
24 const [errorMessage, setErrorMessage] = useState<string>("");
25
26 const fetchRandomVerse = async () => {
27 setStatus("loading");
28 setErrorMessage("");
46 : endpoint.url;
47
48 const response = await fetch(url, {
49 mode: "cors", // Enable CORS
50 headers: {
76 setStatus("error");
77 setErrorMessage(
78 `Failed to fetch verse after ${maxAttempts} attempts. ${
79 error instanceof Error ? error.message : "Unknown error"
80 }. Please try again later.`,
85 };
86
87 // Auto-fetch verse on component mount
88 useEffect(() => {
89 fetchRandomVerse();
90 }, []);
91
217 </div>
218 <button
219 onClick={fetchRandomVerse}
220 disabled={status === "loading"}
221 style={{
261
262 try {
263 const response = await fetch("https://bible-api.com/?random=true&translation=asv");
264 const data = await response.json();
265

FetchBasic2 file matches

@ther•Updated 3 days ago

GithubPRFetcher

@andybak•Updated 6 days ago