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=877&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 13103 results for "fetch"(2286ms)

OpenTowniesystem_prompt.txt2 matches

@AIWB•Updated 4 months ago
155 * The main App component is rendered on the client.
156 * No server-side-specific code should be included in the App.
157 * Use fetch to communicate with the backend server portion.
158 */
159function App() {
178 * Server-only code
179 * Any code that is meant to run on the server should be included in the server function.
180 * This can include endpoints that the client side component can send fetch requests to.
181 */
182export default async function server(request: Request): Promise<Response> {

OpenTownieindex1 match

@AIWB•Updated 4 months ago
26
27 try {
28 const response = await fetch("/", {
29 method: "POST",
30 headers: { "authorization": "Bearer " + bearerToken },

OpenTowniegenerateCode1 match

@AIWB•Updated 4 months ago
26
27export async function generateCodeAnthropic(messages: Message[]): Promise<ValResponse | null> {
28 const system = await (await fetch(`${import.meta.url.split("/").slice(0, -1).join("/")}/system_prompt.txt`)).text();
29
30 const openai = new OpenAI({

ThumbMakermain.tsx1 match

@AIWB•Updated 4 months ago
394app.get('/main.js', serve(js, 'text/javascript'));
395
396export default app.fetch;

azureDinosaurmain.tsx2 matches

@AIWB•Updated 4 months ago
1import { fetchFile, toBlobURL } from "https://esm.sh/@ffmpeg/util";
2import { FFmpeg } from "https://maxm-emeraldox.web.val.run/@ffmpeg/ffmpeg";
3
8 wasmURL: `https://esm.sh/@ffmpeg/core@0.12.6/dist/umd/ffmpeg-core.wasm`,
9});
10console.log(FFmpeg, fetchFile, toBlobURL);

createWebsitemain.tsx4 matches

@Mostafa3135•Updated 4 months ago
68 e.preventDefault();
69 try {
70 const response = await fetch(`${API_BASE_URL}/login`, {
71 method: 'POST',
72 headers: { 'Content-Type': 'application/json' },
121
122 try {
123 const response = await fetch(`${API_BASE_URL}/signup`, {
124 method: 'POST',
125 headers: { 'Content-Type': 'application/json' },
181
182 try {
183 const response = await fetch(`${API_BASE_URL}/upload`, {
184 method: 'POST',
185 body: formData
215
216 try {
217 const response = await fetch(`${API_BASE_URL}/chat`, {
218 method: 'POST',
219 headers: { 'Content-Type': 'application/json' },

sqliteAdminDashboardmain.tsx15 matches

@alpaca1712•Updated 4 months ago
15
16 useEffect(() => {
17 fetchTables();
18 }, []);
19
20 const fetchTables = async () => {
21 try {
22 const response = await fetch("/tables");
23 const data = await response.json();
24 setTables(data);
25 } catch (err) {
26 setError("Failed to fetch tables");
27 }
28 };
29
30 const fetchTableData = async (tableName) => {
31 try {
32 const dataResponse = await fetch(`/table/${tableName}`);
33 const data = await dataResponse.json();
34 setTableData(data);
35
36 const schemaResponse = await fetch(`/schema/${tableName}`);
37 const schema = await schemaResponse.json();
38 setTableSchema(schema);
46 setNewRow(emptyRow);
47 } catch (err) {
48 setError(`Failed to fetch data for table ${tableName}`);
49 }
50 };
56 const handleSave = async (index) => {
57 try {
58 const response = await fetch(`/update/${selectedTable}`, {
59 method: "POST",
60 headers: {
67 }
68 setEditingRow(null);
69 await fetchTableData(selectedTable);
70 } catch (err) {
71 setError(`Failed to update row: ${err.message}`);
85 const handleAddRow = async () => {
86 try {
87 const response = await fetch(`/insert/${selectedTable}`, {
88 method: "POST",
89 headers: {
95 throw new Error("Failed to add new row");
96 }
97 await fetchTableData(selectedTable);
98 // Reset newRow to empty values
99 const emptyRow = Object.keys(newRow).reduce((acc, key) => {
109 const handleDeleteTable = async () => {
110 try {
111 const response = await fetch(`/table/${selectedTable}`, {
112 method: "DELETE",
113 });
121 setTableData([]);
122 setTableSchema([]);
123 await fetchTables();
124 } catch (err) {
125 setError(`Failed to delete table: ${err.message}`);
135 <li
136 key={table}
137 onClick={() => fetchTableData(table)}
138 className={selectedTable === table ? "active" : ""}
139 >

competentOlivePeacockmain.tsx9 matches

@awhitter•Updated 4 months ago
53
54 useEffect(() => {
55 fetchContent();
56 }, []);
57
58 const fetchContent = async () => {
59 try {
60 const response = await fetch("/api/content");
61 const data = await response.json();
62 if (data.records) {
63 setContent(data.records);
64 } else {
65 throw new Error("Failed to fetch content");
66 }
67 setLoading(false);
68 } catch (error) {
69 console.error("Error fetching content:", error);
70 setLoading(false);
71 }
99 const analyzeContent = async (item: AirtableRecord) => {
100 try {
101 const response = await fetch("/api/analyze", {
102 method: "POST",
103 headers: {
265
266 try {
267 const response = await fetch(airtableUrl, {
268 headers: {
269 "Authorization": `Bearer ${apiToken}`,
279 return new Response(JSON.stringify(data), { headers });
280 } catch (error) {
281 console.error("Error fetching Airtable data:", error);
282 return new Response(JSON.stringify({ error: "Error fetching data from Airtable" }), {
283 status: 500,
284 headers,

regexWordSearchPagemain.tsx4 matches

@jrunning•Updated 4 months ago
15
16 useEffect(() => {
17 async function fetchWords() {
18 try {
19 const response = await fetch('https://raw.githubusercontent.com/dwyl/english-words/refs/heads/master/words.txt');
20 if (!response.ok) throw new Error('Failed to fetch words');
21 const text = await response.text();
22 const wordList = text.split('\n')
38 }
39 }
40 fetchWords();
41 }, []);
42

githubParsermain.tsx23 matches

@yawnxyz•Updated 4 months ago
243
244
245 async function fetchFileTypes(repoUrl) {
246 const response = await fetch('/file-types', {
247 method: 'POST',
248 headers: { 'Content-Type': 'application/json' },
375 try {
376 console.log('Sending request to /parse endpoint...');
377 const response = await fetch('/parse', {
378 method: 'POST',
379 headers: {
444 try {
445 const ignoredPatterns = parseIgnoredPatterns();
446 const fileTypes = await fetchFileTypes(repoUrl);
447 displayFileTypeSelector(fileTypes, ignoredPatterns);
448 } catch (error) {
500 }
501
502 console.log(`Fetching content for ${owner}/${repo}`);
503 const content = await fetchRepositoryContent(owner, repo, branch, ignoredPatterns, selectedTypes);
504 const tokenCounts = await countTokens(content);
505
587}
588
589async function fetchRepositoryContent(owner, repo, specifiedBranch = null, ignoredPatterns, selectedTypes = null) {
590 // First, try to get the default branch or use the specified branch
591 const repoInfoUrl = `https://api.github.com/repos/${owner}/${repo}`;
592 const repoInfoResponse = await fetch(repoInfoUrl, {
593 headers: {
594 'Authorization': `token ${Deno.env.get("GITHUB_API_KEY")}`,
601 throw new Error(`Repository not found or not accessible: ${owner}/${repo}`);
602 }
603 throw new Error(`Failed to fetch repository info: ${repoInfoResponse.statusText}`);
604 }
605
608
609 const apiUrl = `https://api.github.com/repos/${owner}/${repo}/git/trees/${defaultBranch}?recursive=1`;
610 const response = await fetch(apiUrl, {
611 headers: {
612 'Authorization': `token ${Deno.env.get("GITHUB_API_KEY")}`,
617 if (!response.ok) {
618 if (response.status === 404) {
619 throw new Error(`Failed to fetch repository content. The ${defaultBranch} branch might not exist.`);
620 }
621 throw new Error(`GitHub API request failed: ${response.statusText}`);
645 for (const file of files) {
646 try {
647 const fileContent = await fetchFileContent(owner, repo, file.path, defaultBranch);
648 content += `File: ${file.path}\n\n${fileContent}\n\n`;
649 } catch (error) {
650 console.error(`Failed to fetch content for ${file.path}: ${error.message}`);
651 content += `File: ${file.path}\n\nError: Failed to fetch content\n\n`;
652 }
653 }
661}
662
663async function fetchFileContent(owner, repo, path, branch) {
664 const apiUrl = `https://api.github.com/repos/${owner}/${repo}/contents/${path}`;
665 const response = await fetch(apiUrl, {
666 headers: {
667 'Authorization': `token ${Deno.env.get("GITHUB_API_KEY")}`,
671
672 if (!response.ok) {
673 throw new Error(`Failed to fetch file content: ${response.statusText}`);
674 }
675
792}
793
794// Add new endpoint to handle file type fetching
795app.post("/file-types", async (c) => {
796 try {
822async function getRepositoryFileTypes(owner, repo, specifiedBranch = null) {
823 const repoInfoUrl = `https://api.github.com/repos/${owner}/${repo}`;
824 const repoInfoResponse = await fetch(repoInfoUrl, {
825 headers: {
826 'Authorization': `token ${Deno.env.get("GITHUB_API_KEY")}`,
830
831 if (!repoInfoResponse.ok) {
832 throw new Error(`Failed to fetch repository info: ${repoInfoResponse.statusText}`);
833 }
834
837
838 const apiUrl = `https://api.github.com/repos/${owner}/${repo}/git/trees/${defaultBranch}?recursive=1`;
839 const response = await fetch(apiUrl, {
840 headers: {
841 'Authorization': `token ${Deno.env.get("GITHUB_API_KEY")}`,
863}
864
865// Export app.fetch for Val Town, otherwise export app — this is only for hono apps
866export default (typeof Deno !== "undefined" && Deno.env.get("valtown")) ? app.fetch : app;
867

fetch-socials4 file matches

@welson•Updated 3 days ago
fetch and archive my social posts

fetchRssForSubcurrent2 file matches

@ashryanio•Updated 3 days ago