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=273&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 2746 results for "fetch"(306ms)

testMutateSemanticsmain.tsx4 matches

@stevekrouse•Updated 1 year ago
1import process from "node:process";
2import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
3
4export async function testMutateSemantics({
17 authenticated: boolean;
18}) {
19 const { data: last } = await fetchJSON(
20 `${api}/eval/${stateName}`
21 );
22 const now = Date.now();
23 await fetchJSON(
24 `${api}/eval/${mutator(now)}`,
25 authenticated
29 : undefined
30 );
31 const { data: next } = await fetchJSON(
32 `${api}/eval/${stateName}`
33 );

reasonPhraseREADME.md3 matches

@tmcw•Updated 1 year ago
11_None of this information is useful. The reason-phrase is barely supported on the web and was always an oddity, but keep reading if you like oddities!_
12
13If you're used to JavaScript’s `fetch()` method to make HTTP requests, you've seen the `reason-phrase` under a different name: `statusText`:
14
15```ts
16(await fetch('https://example.com/')).statusText
17```
18
48```
49
50Unfortunately, this doesn't work! The response that Val Town produces is reorganized and optimized by Cloudflare, which upgrades requests and responses from HTTP 1.1 to HTTP 2. And sadly, HTTP 2 [dropped support for the custom reason-phrase](https://fetch.spec.whatwg.org/#concept-response-status-message).
51
52_RIP the `reason-phrase`._ It was present even in a [1992 draft of the HTTP specification](https://www.w3.org/Protocols/HTTP/Response.html), and was a weird and under-appreciated way to pilfer extra information in a response. Now, thanks to HTTP/2 and the commonplace use of proxies and CDNs like Cloudflare, it's no longer usable. It was fun while it lasted.

duckdbExampleREADME.md1 match

@tmcw•Updated 1 year ago
1# DuckDB
2
3[DuckDB](https://duckdb.org/) works on Val Town, with only one small tweak! We're basically using DuckDB in the same way you'd use it with a browser - using the WASM package with its dependencies fetched from [jsdelivr](https://www.jsdelivr.com/).
4
5The only trick is to create the worker ourselves rather than using `duckdb.createWorker`. DuckDB's built-in createWorker method doesn't specify a worker type, which causes `type` to default to `classic`, and Deno (our runtime) doesn't support classic workers.

arenaApiExampleREADME.md1 match

@tmcw•Updated 1 year ago
3Example of using the [are.na](https://dev.are.na/documentation/channels#Block43472) API to get the contents of an Are.na board - specifically my fun board that showcases websites with that "glossy black style."
4
5All you need is [fetch](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) to make this happen!
6
7Migrated from folder: API_Examples/arenaApiExample

kyExampleREADME.md2 matches

@tmcw•Updated 1 year ago
1# ky
2
3The [ky module](https://www.npmjs.com/package/ky) is a nice abstraction around the [fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API), which is easily compatible with Deno. It's by the same creator as [got](https://npmjs.com/got), which more explicitly targets Node.js.
4
5Most of the time, the `fetch` method is all you need! But in a pinch, you can use `ky` to make things a little fancier.
6
7Migrated from folder: Modules/kyExample

valTownApiExampleValREADME.md1 match

@tmcw•Updated 1 year ago
1# Val Town API: Find a val by handle and name
2
3This val fetches itself via the [Val Town API](https://docs.val.town/api/reference)! Weird, right?
4
5Migrated from folder: Val_Town_API/valTownApiExampleVal

fetchPaginatedData2 file matches

@nbbaier•Updated 6 days ago

tweetFetcher2 file matches

@nbbaier•Updated 1 week ago