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=765&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 7887 results for "fetch"(1089ms)

communityBoatingFlagREADME.md1 match

@twschillerUpdated 1 year ago
1Fetch the sailing flag color from https://www.community-boating.org/

API_URLREADME.md1 match

@stdUpdated 1 year ago
8import { API_URL } from "https://esm.town/v/std/API_URL";
9
10const response = await fetch(`${API_URL}/v1/me`, {
11 headers: {
12 Authorization: `Bearer ${Deno.env.get("valtown")}`,

fetchREADME.md8 matches

@stdUpdated 1 year ago
1# Proxied fetch - [Docs ↗](https://docs.val.town/std/fetch)
2
3The Javascript [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) is directly available within a Val. However sometimes fetch calls are blocked by the receiving server for using particular IP addresses. Additionally, network blips or unreliable web services may lead to failures if not handled properly.
4
5The Val Town standard library contains an alternative version, [`std/fetch`](https://www.val.town/v/std/fetch), that wraps the JavaScript Fetch API to provide additional functionality. The fetch function from [`std/fetch`](https://www.val.town/v/std/fetch) reroutes requests using a proxy vendor so that requests obtain different IP addresses. It also automatically retries failed requests several times. Note that using [`std/fetch`](https://www.val.town/v/std/fetch) will be significantly slower than directly calling the Javascript Fetch API due to extra network hops.
6
7## Usage
8
9After importing [`std/fetch`](https://www.val.town/v/std/fetch), the fetch method is used with the same signature as the Javascript Fetch API.
10
11```ts title="Example" val
12import { fetch } from "https://esm.town/v/std/fetch";
13
14let result = await fetch("https://api64.ipify.org?format=json");
15let json = await result.json();
16console.log(json.ip);
17```
18
19If you run the above code multiple times, you'll see that it returns different IP addresses, because [`std/fetch`](https://www.val.town/v/std/fetch) uses proxies so that each request is made from a different IP address.
20
21
22[📝 Edit docs](https://github.com/val-town/val-town-docs/edit/main/src/content/docs/std/fetch.md)

whatIsMyIpREADME.md1 match

@nicoUpdated 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.

fetchAndParseFeedsREADME.md1 match

@iakovosUpdated 1 year ago
1Migrated from folder: RSS/fetchAndParseFeeds

fetchAndStoreREADME.md1 match

@talUpdated 1 year ago
1Migrated from folder: lunchMenu/fetchAndStore

fetchTextREADME.md1 match

@iakovosUpdated 1 year ago
1Migrated from folder: RSS/utils/fetchText

blogRSSREADME.md3 matches

@stevekrouseUpdated 1 year ago
7## Architecture
8
91. Fetch and parse the HTML of https://blog.val.town – @stevekrouse.valTownBlogJSON.
102. Create an RSS string out of that array of blog objects – @stevekrouse.valTownBlogRSS.
113. Expose [an endpoint that returns that RSS](https://stevekrouse-blogRSS.web.val.run), with appropriate content-type and cache headers – this val, @stevekrouse.blogRSS
13## Notes
14
15* This is very inefficient. It refetches and re-parses blog.val.town on every single request, modulo some caching via the headers. It would be much more efficient to cache the results of fetching and parsing the Val Town blog, and then only re-fetch it every 10 minutes or so.
16* Instead of fetching and parsing HTML from super.so, we could get this same data from Notion's API, with a val like @stevekrouse.notionGetDatabase.
17
18Migrated from folder: Archive/blogRSS

fetchAndParseXMLREADME.md1 match

@mgruelUpdated 1 year ago
1Migrated from folder: common/fetchAndParseXML

fetchTextREADME.md1 match

@mgruelUpdated 1 year ago
1Migrated from folder: common/fetchText

fetchPaginatedData2 file matches

@nbbaierUpdated 1 week ago

FetchBasic1 file match

@fredmoonUpdated 1 week ago