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/image-url.jpg?q=fetch&page=4&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 8146 results for "fetch"(644ms)

helloooooooindex.html2 matches

@charmaine•Updated 16 hours ago
116 posts = window.INITIAL_DATA.posts;
117 } else {
118 const response = await fetch('/api/posts');
119 posts = await response.json();
120 }
156
157 try {
158 const response = await fetch(`/api/posts/${params.slug}`);
159
160 if (!response.ok) {

sqliteExplorerApp2main.tsx4 matches

@shouser•Updated 16 hours ago
1/** @jsxImportSource npm:hono/jsx **/
2
3import { 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});
176
177export const handler = app.fetch;
178export default iframeHandler(modifyFetchHandler(passwordAuth(handler, { verifyPassword: verifyToken })));

blogggggindex.ts1 match

@charmaine•Updated 17 hours ago
167}
168
169export default app.fetch;

TownieuseProject.tsx5 matches

@valdottown•Updated 17 hours ago
11 const [error, setError] = useState(null);
12
13 const fetchData = async () => {
14 try {
15 const projectEndpoint = new URL(PROJECT_ENDPOINT, window.location.origin);
23 };
24
25 const { project } = await fetch(projectEndpoint, { headers })
26 .then(res => res.json());
27 const { files } = await fetch(filesEndpoint, { headers })
28 .then(res => res.json());
29
40 useEffect(() => {
41 if (!projectId) return;
42 fetchData();
43 }, [projectId, branchId]);
44
45 return { data, loading, error, refetch: fetchData };
46}
47

TownieuseProjects.tsx5 matches

@valdottown•Updated 17 hours ago
10 const [error, setError] = useState(null);
11
12 const fetchData = async () => {
13 try {
14 const res = await fetch(ENDPOINT, {
15 headers: {
16 "Authorization": "Bearer " + token,
18 })
19 const data = await res.json();
20 console.log("useProjects fetchData", { res, data });
21 if (!res.ok) {
22 console.error(data);
39
40 useEffect(() => {
41 fetchData();
42 }, []);
43
44 return { data, loading, error, refetch: fetchData };
45}
46

TownieuseCreateProject.tsx1 match

@valdottown•Updated 17 hours ago
19 setError(null);
20 try {
21 const res = await fetch(ENDPOINT, {
22 method: "POST",
23 headers: {

TownieuseCreateBranch.tsx1 match

@valdottown•Updated 17 hours ago
16 setData(null);
17 setError(null);
18 const res = await fetch(ENDPOINT, {
19 method: "POST",
20 headers: {

TownieuseBranches.tsx4 matches

@valdottown•Updated 17 hours ago
9 const [loading, setLoading] = useState(true);
10
11 const fetchData = async () => {
12 const endpoint = new URL(ENDPOINT, window.location.origin);
13 endpoint.searchParams.append("projectId", projectId);
14
15 const res = await fetch(endpoint, {
16 headers: {
17 "Authorization": "Bearer " + token,
24 useEffect(() => {
25 if (!projectId) return;
26 fetchData();
27 }, [projectId]);
28
29 return { data, loading, refetch: fetchData };
30}
31

TownieTODOs.md1 match

@valdottown•Updated 17 hours ago
47<!--
48
49- [x] refetch project data on create/etc
50- [x] Loading favicon
51- [x] Ensure main branch is default selected

Townietext-editor.ts1 match

@valdottown•Updated 17 hours ago
136 let type_: "file" | "http" | "script";
137 if (path.includes("backend/index.ts")) type_ = "http";
138 if (file_text?.includes("export default app.fetch")) type_ = "http";
139 if ([".ts", ".tsx", ".js", ".jsx"].some(ext => path.endsWith(ext))) {
140 type_ = "script";

fetchPaginatedData2 file matches

@nbbaier•Updated 1 week ago

FetchBasic1 file match

@fredmoon•Updated 1 week ago