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%20%22Image%20title%22?q=fetch&page=1104&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 12867 results for "fetch"(7848ms)

tree_examplemain.tsx3 matches

@pomdtr•Updated 1 year ago
8import { Hono } from "npm:hono";
9
10// The tree is fetched using an http request, so any http framework can be used
11const app = new Hono();
12
49});
50
51// this endpoint is used to dynamically fetch a list of tags from the api
52app.get("/tags/:tag", async (c) => {
53 let { tag } = c.req.param();
85}
86
87export default app.fetch;
88

blog_mdxmain.tsx1 match

@pomdtr•Updated 1 year ago
108});
109
110export default app.fetch;
111

jsoninvoicemain.tsx1 match

@pomdtr•Updated 1 year ago
74});
75
76export default app.fetch;
77

isMyWebsiteDownmain.tsx2 matches

@jkriesp•Updated 1 year ago
9 let reason: string;
10 try {
11 const res = await fetch(URL, { redirect: "follow" });
12 if (res.status !== 200) {
13 reason = `(status code: ${res.status})`;
15 }
16 } catch (e) {
17 reason = `couldn't fetch: ${e}`;
18 ok = false;
19 }

auth_middlewaremain.tsx5 matches

@pomdtr•Updated 1 year ago
35};
36
37async function fetchUser(token: string): Promise<User> {
38 const resp = await fetch("https://api.val.town/v1/me", {
39 headers: {
40 Authorization: `Bearer ${token}`,
43
44 if (resp.status !== 200) {
45 throw new Error("Could not fetch user");
46 }
47
50
51async function isCurrentUser(userID: string) {
52 const currentUser = await fetchUser(Deno.env.get("valtown"));
53 return userID == currentUser.id;
54}
82 const formData = await req.formData();
83 const token = formData.get("token").toString();
84 const user = await fetchUser(token);
85 if (await isCurrentUser(user.id)) {
86 return new Response("Unauthorized", {

bookmarkmain.tsx1 match

@ramkarthik•Updated 1 year ago
111});
112
113export default app.fetch;

cors_examplemain.tsx1 match

@neverstew•Updated 1 year ago
9 async function request(url, options) {
10 try {
11 const response = await fetch(url, options);
12 const status = response.status;
13 const data = await response.text();

ask_aimain.tsx1 match

@pomdtr•Updated 1 year ago
43- You can use in JavaScript, TypeScript, JSX, or TSX
44- Utilize Deno-style import syntax for NPM packages, prefixed with "npm:"
45- Prefer native fetch for HTTP requests instead of axios
46- Prefer double quotes to single quotes
47

hackernews_cmdkmain.tsx1 match

@pomdtr•Updated 1 year ago
54});
55
56export default app.fetch;

github_cmdk_extensionmain.tsx1 match

@pomdtr•Updated 1 year ago
28 })
29
30 return app.fetch
31}

fetch-socials4 file matches

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

fetchRssForSubcurrent2 file matches

@ashryanio•Updated 2 days ago