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=209&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 2581 results for "fetch"(340ms)

townieBearprojectService.ts1 match

@charmaine•Updated 1 month ago
1export async function createProject(projectName: string) {
2 const response = await fetch('/api/projects', {
3 method: 'POST',
4 headers: {

project_to_textindex.ts3 matches

@dcm31•Updated 1 month ago
95 if (failedFiles.length > 0) {
96 const failedFilesList = failedFiles.map(f => `'${f.path}': ${f.error}`).join(", ");
97 throw new Error(`Failed to fetch content for files: ${failedFilesList}`);
98 }
99
107});
108
109// HTTP vals expect an exported "fetch handler"
110// This is how you "run the server" in Val Town with Hono
111export default app.fetch;

project_to_textApp.tsx1 match

@dcm31•Updated 1 month ago
11 const onExportClick = async () => {
12 if (name && username) {
13 const response = await fetch(`/text?name=${name}&username=${username}`);
14 const data = await response.text();
15 setText(data);

statusmonitor2 matches

@vico•Updated 1 month ago
15 const start = performance.now();
16 try {
17 res = await fetch(url);
18 end = performance.now();
19 status = res.status;
25 } catch (e) {
26 end = performance.now();
27 reason = `couldn't fetch: ${e}`;
28 ok = false;
29 }

reactHonoExampleMessageInput.tsx1 match

@moe•Updated 1 month ago
11
12 try {
13 const response = await fetch("/messages", {
14 method: "POST",
15 headers: { "Content-Type": "application/json" },

reactHonoExampleindex.ts2 matches

@moe•Updated 1 month ago
60});
61
62// HTTP vals expect an exported "fetch handler"
63// This is how you "run the server" in Val Town with Hono
64export default app.fetch;

reactHonoExampleApp.tsx4 matches

@moe•Updated 1 month ago
9 const [messages, setMessages] = React.useState(initialMessages);
10
11 const fetchMessages = async () => {
12 try {
13 const response = await fetch("/messages");
14 const data = await response.json();
15 setMessages(data.reverse());
16 } catch (error) {
17 console.error("Failed to fetch messages", error);
18 }
19 };
23 <h1>💬 Message Board!</h1>
24 <MessageList messages={messages} />
25 <MessageInput onSubmit={fetchMessages} />
26 {thisProjectURL
27 ? (

countGithubLOC_506743README.md1 match

@g•Updated 1 month ago
13The following vals could not be imported:
14
15- [g/countGithubLOC](https://www.val.town/v/g/countGithubLOC) - Failed to fetch val: {"statusCode":404,"error":"Not Found","message":"Could not find that val"}
16
17

countGithubLOC_506743countGithubLOCUI3 matches

@g•Updated 1 month ago
1/**
2 * This val creates a website to count lines of code in GitHub repositories.
3 * It uses a server-side API to fetch the data and a client-side UI for user interaction.
4 * It now includes sharing functionality and URL manipulation for better user experience.
5 */
185
186 try {
187 const response = await fetch(`/api/${user}/${repo}`);
188 const data = await response.json();
189
315});
316
317export default app.fetch;

statusmonitor2 matches

@Vyqda•Updated 1 month ago
15 const start = performance.now();
16 try {
17 res = await fetch(url);
18 end = performance.now();
19 status = res.status;
25 } catch (e) {
26 end = performance.now();
27 reason = `couldn't fetch: ${e}`;
28 ok = false;
29 }

fetchPaginatedData2 file matches

@nbbaier•Updated 5 days ago

tweetFetcher2 file matches

@nbbaier•Updated 1 week ago