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=1381&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 15395 results for "fetch"(3607ms)

sqlite_docsmain.tsx2 matches

@andreterron•Updated 1 year ago
35
36async function execute(statement: InStatement): Promise<ResultSet> {
37 const res = await fetch(`${API_URL}/v1/sqlite/execute`, {
38 method: "POST",
39 headers: {
49
50async function batch(statements: InStatement[], mode?: TransactionMode): Promise<ResultSet[]> {
51 const res = await fetch(`${API_URL}/v1/sqlite/batch`, {
52 method: "POST",
53 headers: {

blob_docsmain.tsx4 matches

@andreterron•Updated 1 year ago
82async function list(prefix?: string): Promise<{ key: string; size: number; lastModified: string }[]> {
83 let querystring = prefix ? `?prefix=${encodeURIComponent(prefix)}` : "";
84 const res = await fetch(`${API_URL}/v1/blob${querystring}`, {
85 headers: {
86 Authorization: `Bearer ${Deno.env.get("valtown")}`,
95
96async function delete_(key: string) {
97 const res = await fetch(`${API_URL}/v1/blob/${encodeURIComponent(key)}`, {
98 method: "DELETE",
99 headers: {
108
109async function get(key: string) {
110 const res = await fetch(`${API_URL}/v1/blob/${encodeURIComponent(key)}`, {
111 headers: {
112 Authorization: `Bearer ${Deno.env.get("valtown")}`,
124
125async function set(key: string, value: BodyInit) {
126 const res = await fetch(`${API_URL}/v1/blob/${encodeURIComponent(key)}`, {
127 method: "POST",
128 headers: {

sqlite_adminmain.tsx1 match

@robsimmons•Updated 1 year ago
9app.get("/", async (c) => c.html(await sqlite_admin_tables()));
10app.get("/:table", async (c) => c.html(await sqlite_admin_table(c.req.param("table"))));
11export default basicAuth(app.fetch);

v1main.tsx1 match

@naserdehghan•Updated 1 year ago
11});
12
13export default app.fetch;

valshotmain.tsx3 matches

@burningion•Updated 1 year ago
1// SPDX-License-Identifier: 0BSD
2import { fetchVal } from "https://esm.town/v/vladimyr/fetchVal";
3import { serveReadme } from "https://esm.town/v/vladimyr/serveReadme";
4import { toHonoHandler } from "https://esm.town/v/vladimyr/toHonoHandler";
11 // const { author, name } = c.req.param();
12 const query = c.req.query();
13 const res = await fetch(
14 "https://raw.githubusercontent.com/burningion/dab-and-tpose-controlled-lights/master/src/dab-tpose-controller.py",
15 );
19});
20
21export default router.fetch;
22
23export async function createScreenshot(code: string, theme: string = "dark-plus"): Promise<URL> {

love_letterREADME.md3 matches

@pomdtr•Updated 1 year ago
24In any other platform, I would have just given up and moved on. But Val Town is different. I was confident that I could address this issue in userspace, without having to wait for the platform to implement it.
25
26Val Town allows you to run a val on a cron schedule, so I wrote a val that would fetch all the vals from the API, and store them as a sqlite table (did I mention that every user get it's own sqlite database ?).
27
28```ts
38 let url = "https://api.val.town/v1/search/vals?query=%20&limit=100";
39
40 // fetch all vals, and store them in the sqlite table
41 while (true) {
42 const resp = await fetch(url);
43 if (!resp.ok) {
44 throw new Error(await resp.text());

pushovermain.tsx2 matches

@pranjaldotdev•Updated 1 year ago
1import { fetch } from "https://esm.town/v/std/fetch";
2
3// Send a pushover message.
16 url: string;
17}) {
18 return await fetch("https://api.pushover.net/1/messages.json", {
19 method: "POST",
20 headers: {

scrapermain.tsx3 matches

@pranjaldotdev•Updated 1 year ago
9}
10
11async function fetchText(url: string, options?: any) {
12 const response = await fetch(normalizeURL(url), {
13 redirect: "follow",
14 ...(options || {}),
19
20export const webScrapeBytesNewsletter = async () => {
21 const html = await fetchText(NEWSLETTER_URL);
22 const $ = cheerio.load(html);
23 const latestIssueSection = $("main > :nth-child(2)");

indigoWombatmain.tsx4 matches

@josh_len•Updated 1 year ago
1import { email } from "https://esm.town/v/std/email?v=9";
2
3// Fetches a random joke.
4async function fetchRandomJoke() {
5 const response = await fetch(
6 "https://official-joke-api.appspot.com/random_joke",
7 );
9}
10
11const randomJoke = await fetchRandomJoke();
12const setup = randomJoke.setup;
13const punchline = randomJoke.punchline;

jsrmain.tsx2 matches

@vladimyr•Updated 1 year ago
24 let example;
25 try {
26 example = await fetchValtownExample(scope, name, version);
27 } catch {}
28 if (example) {
39}
40
41async function fetchValtownExample(scope: string, name: string, version: string) {
42 const pkgConfig = await getConfig(scope, name, version);
43 version = pkgConfig.version;

fake-https1 file match

@blazemcworld•Updated 1 week ago
simple proxy to fetch http urls using https

testWeatherFetcher1 file match

@sjaskeprut•Updated 2 weeks ago