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=766&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 7885 results for "fetch"(1350ms)

fetchJSONREADME.md1 match

@mgruel•Updated 1 year ago
1Migrated from folder: common/fetchJSON

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.

getCommentsREADME.md1 match

@neverstew•Updated 1 year ago
1# GET /v1/me/comments
2Fetches information about any comments on vals.
3
4Requires a secret called valtownToken, set to your API Token. See more about [authentication](https://docs.val.town/api/authentication) to understand how to generate a token.

getLikesREADME.md1 match

@neverstew•Updated 1 year ago
1# GET /v1/me/likes
2Fetches information about any val you "like".
3
4Requires a secret called valtownToken, set to your API Token. See more about [authentication](https://docs.val.town/api/authentication) to understand how to generate a token.

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.

lichessPgnREADME.md1 match

@jdan•Updated 1 year ago
1Fetches the PGN for a [Lichess](https://lichess.org) game.
2
3Migrated from folder: lichess/lichessPgn

getRunsREADME.md1 match

@neverstew•Updated 1 year ago
1# GET /v1/me/runs
2
3Fetches information about runs of any val you author.
4
5Requires a secret called valtownToken, set to your API Token. See more about [authentication](https://docs.val.town/api/authentication) to understand how to generate a token.

getMeREADME.md1 match

@neverstew•Updated 1 year ago
1# GET `/v1/me`
2Fetches information about yourself.
3
4Requires a secret called `valtownToken`, set to your API Token. See more about [authentication](https://docs.val.town/api/authentication) to understand how to generate a token.

handleFetchTextResponseREADME.md1 match

@devdoshi•Updated 1 year ago
1Migrated from folder: webpush/handleFetchTextResponse

whatIsMyIpREADME.md1 match

@devdoshi•Updated 1 year ago
1I wanted to see if val.town forwards my client IP Address using the x-forwarded-for header, which it does, but cloudflare provides the True-Client-IP header as well. When you run a val on the website, it is actually running from val's servers so it won't come from your client IP. You'll need to copy the express fetch and run that from your client.
2
3Migrated from folder: helpers/whatIsMyIp

fetchPaginatedData2 file matches

@nbbaier•Updated 1 week ago

FetchBasic1 file match

@fredmoon•Updated 1 week ago