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=586&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 7881 results for "fetch"(1625ms)

dailySlackRoundupmain.tsx2 matches

@thatbeautifuldream•Updated 10 months ago
1import { fetch } from "https://esm.town/v/std/fetch";
2import { getDayName } from "https://esm.town/v/stevekrouse/getDayName?v=2";
3import process from "node:process";
4
5export const dailySlackRoundup = (async () => {
6 const res = await fetch(process.env.BRAINBOT_WEBHOOK_URL, {
7 method: "POST",
8 body: JSON.stringify({

spotifymain.tsx9 matches

@anthonyec•Updated 10 months ago
2import { home, scopesRoute } from "https://esm.town/v/hunty/spotify_helpers";
3import { sqlite } from "https://esm.town/v/std/sqlite?v=4";
4import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
5import { querystring } from "https://esm.town/v/stevekrouse/querystring";
6import { thisWebURL } from "https://esm.town/v/stevekrouse/thisWebURL";
25
26export let spotifyRequestToken = ({ client_id, client_secret, code, redirect_uri }) =>
27 fetchJSON("https://accounts.spotify.com/api/token", {
28 method: "POST",
29 body: querystring({
39
40export let spotifyRefreshToken = async ({ refresh_token, client_id, client_secret }) =>
41 fetch("https://accounts.spotify.com/api/token", {
42 method: "POST",
43 body: new URLSearchParams({
193
194 try {
195 const currentlyPlaying = await fetch("https://api.spotify.com/v1/me/player/currently-playing", {
196 method: "GET",
197 headers: {
209
210 if (!mostRecentTrack) {
211 const recentTracks = await fetch("https://api.spotify.com/v1/me/player/recently-played", {
212 method: "GET",
213 headers: {
222 }
223 catch (e) {
224 return c.json({ error: "Fetch Error" + e });
225 }
226});
234
235 try {
236 const playStateResponse = await fetch("https://api.spotify.com/v1/me/player?market=US", {
237 method: "GET",
238 headers: {
253 }
254 catch (e) {
255 return c.json({ error: "Fetch Error" + e });
256 }
257});
258
259export default app.fetch;

spotifymain.tsx9 matches

@niek•Updated 10 months ago
2import { home, scopesRoute } from "https://esm.town/v/hunty/spotify_helpers";
3import { sqlite } from "https://esm.town/v/std/sqlite?v=4";
4import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
5import { querystring } from "https://esm.town/v/stevekrouse/querystring";
6import { thisWebURL } from "https://esm.town/v/stevekrouse/thisWebURL";
25
26export let spotifyRequestToken = ({ client_id, client_secret, code, redirect_uri }) =>
27 fetchJSON("https://accounts.spotify.com/api/token", {
28 method: "POST",
29 body: querystring({
39
40export let spotifyRefreshToken = async ({ refresh_token, client_id, client_secret }) =>
41 fetch("https://accounts.spotify.com/api/token", {
42 method: "POST",
43 body: new URLSearchParams({
193
194 try {
195 const currentlyPlaying = await fetch("https://api.spotify.com/v1/me/player/currently-playing", {
196 method: "GET",
197 headers: {
209
210 if (!mostRecentTrack) {
211 const recentTracks = await fetch("https://api.spotify.com/v1/me/player/recently-played", {
212 method: "GET",
213 headers: {
222 }
223 catch (e) {
224 return c.json({ error: "Fetch Error" + e });
225 }
226});
234
235 try {
236 const playStateResponse = await fetch("https://api.spotify.com/v1/me/player?market=US", {
237 method: "GET",
238 headers: {
253 }
254 catch (e) {
255 return c.json({ error: "Fetch Error" + e });
256 }
257});
258
259export default app.fetch;

translatemain.tsx3 matches

@yawnxyz•Updated 10 months ago
3export async function translate(req: Request) {
4 if (req.method === "POST") {
5 return await fetch("https://deepl.deno.dev/translate", {
6 method: "POST",
7 body: await req.text(),
34 <script type="module">
35 import { html, Component, render } from "https://cdn.cbd.int/htm/preact/standalone.module.js";
36 import { ofetch } from "https://esm.sh/ofetch/dist/index.mjs";
37 import { z } from "https://esm.sh/zod";
38 // https://github.com/developit/htm
131 target_lang: z.string().default("zh"),
132 });
133 const data = await ofetch("/", {
134 method: "POST",
135 body: Options.parse({

honoAlpineHtmxDemomain.tsx1 match

@yawnxyz•Updated 10 months ago
66});
67
68export default app.fetch;

honoAlpineExamplemain.tsx1 match

@yawnxyz•Updated 10 months ago
64});
65
66export default app.fetch;

convertToResumeJSONmain.tsx1 match

@iamseeley•Updated 10 months ago
135 ];
136
137 const response = await fetch(endpoint, {
138 method: 'POST',
139 headers: {

valTownChatGPTmain.tsx2 matches

@xuybin•Updated 10 months ago
33
34 // Post the message so we can deal with large text data.
35 await fetch(`/post-message?threadId=${input.getAttribute("data-thread-id")}`, {
36 method: "post",
37 body: msgDiv.textContent,
147 return new Response(body, { headers: { "Content-Type": "text/event-stream" } });
148});
149export default app.fetch;

openAIStreamingREADME.md2 matches

@xuybin•Updated 10 months ago
10assistant > Here are a few fun Val ideas you could build on Val Town:
11
121. **Random Joke Generator:** Fetch a random joke from an API and display it.
132. **Daily Weather Update:** Pull weather data for your location using an API and create a daily summary.
143. **Mini Todo List:** Create a simple to-do list app with add, edit, and delete functionalities.
154. **Chuck Norris Facts:** Display a random Chuck Norris fact sourced from an API.
165. **Motivational Quote of the Day:** Fetch and display a random motivational quote each day.
17
18Which one sounds interesting to you?

vscodemain.tsx1 match

@xuybin•Updated 10 months ago
82 ));
83
84export default app.fetch;

fetchPaginatedData2 file matches

@nbbaier•Updated 1 week ago

FetchBasic1 file match

@fredmoon•Updated 1 week ago