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=250&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"(417ms)

OpenTownieindex1 match

@shouser•Updated 3 months ago
26
27 try {
28 const response = await fetch("/", {
29 method: "POST",
30 headers: { "authorization": "Bearer " + bearerToken },

OpenTowniegenerateCode1 match

@shouser•Updated 3 months ago
26
27export async function generateCodeAnthropic(messages: Message[]): Promise<ValResponse | null> {
28 const system = await (await fetch(`${import.meta.url.split("/").slice(0, -1).join("/")}/system_prompt.txt`)).text();
29
30 const openai = new OpenAI({

reactRouter7server.tsx1 match

@justbe•Updated 3 months ago
5 if (url.pathname == "/js/entry.client.js") {
6 const moduleUrl = new URL("./entry.client.tsx", import.meta.url);
7 return fetch(moduleUrl);
8 }
9 return handler(request);

OpenTowniesystem_prompt.txt2 matches

@shouser•Updated 3 months ago
155 * The main App component is rendered on the client.
156 * No server-side-specific code should be included in the App.
157 * Use fetch to communicate with the backend server portion.
158 */
159function App() {
178 * Server-only code
179 * Any code that is meant to run on the server should be included in the server function.
180 * This can include endpoints that the client side component can send fetch requests to.
181 */
182export default async function server(request: Request): Promise<Response> {

surprisingEmbeddingsembeddingGetter1 match

@tmcw•Updated 3 months ago
13 if (working) {
14 return Response.json({
15 error: "Sorry, another embedding is being fetched, wait a moment and try again",
16 })
17 }

emojiTodoListAppmain.tsx9 matches

@maxm•Updated 3 months ago
9
10 useEffect(() => {
11 fetchTodos();
12 }, []);
13
14 const fetchTodos = async () => {
15 const response = await fetch("/todos");
16 const data = await response.json();
17 setTodos(data);
21 e.preventDefault();
22 if (!newTodo.trim()) return;
23 await fetch("/todos", {
24 method: "POST",
25 headers: { "Content-Type": "application/json" },
27 });
28 setNewTodo("");
29 fetchTodos();
30 };
31
32 const toggleTodo = async (id) => {
33 await fetch(`/todos/${id}`, { method: "PATCH" });
34 fetchTodos();
35 };
36
37 const deleteTodo = async (id) => {
38 await fetch(`/todos/${id}`, { method: "DELETE" });
39 fetchTodos();
40 };
41

importProjectFilemain.tsx1 match

@maxm•Updated 3 months ago
1export async function importProjectFile(moduleUrl: string, path: string) {
2 const url = new URL(path, moduleUrl);
3 const resp = await fetch(url, { method: "GET", headers: { "Authorization": `Bearer ${Deno.env.get("valtown")}` } });
4 if (!resp.ok) return undefined;
5 const text = await resp.text();

CRMmain.tsx20 matches

@stevekrouse•Updated 3 months ago
10 e.preventDefault();
11 try {
12 const response = await fetch("/login", {
13 method: "POST",
14 headers: { "Content-Type": "application/json" },
58 const [tagInput, setTagInput] = useState("");
59
60 // Fetch previous customer details when email changes
61 useEffect(() => {
62 const fetchCustomerDetails = async () => {
63 if (!email) return;
64
65 try {
66 const response = await fetch(`/get-customer-details?email=${encodeURIComponent(email)}`);
67 if (response.ok) {
68 const customerDetails = await response.json();
73 }
74 } catch (error) {
75 console.error("Error fetching customer details:", error);
76 }
77 };
78
79 fetchCustomerDetails();
80 }, [email]);
81
138 e.preventDefault();
139 try {
140 const response = await fetch("/add-interaction", {
141 method: "POST",
142 headers: { "Content-Type": "application/json" },
250 const [uniqueCustomerCount, setUniqueCustomerCount] = useState(0);
251
252 const fetchUniqueCustomerCount = async () => {
253 try {
254 const response = await fetch("/get-unique-customer-count");
255 const data = await response.json();
256 setUniqueCustomerCount(data.count);
257 } catch (error) {
258 console.error("Error fetching unique customer count:", error);
259 }
260 };
261
262 useEffect(() => {
263 fetchInteractions();
264 fetchUniqueCustomerCount();
265 }, [currentPage, selectedTags]);
266
281 const handleDeleteInteraction = async (id) => {
282 try {
283 const response = await fetch("/delete-interaction", {
284 method: "DELETE",
285 headers: { "Content-Type": "application/json" },
288
289 if (response.ok) {
290 fetchInteractions();
291 }
292 } catch (error) {
303 };
304
305 const fetchInteractions = async () => {
306 try {
307 const response = await fetch(`/get-interactions?page=${currentPage}`);
308 const data = await response.json();
309
336 if (selectedTags.length > 0) {
337 // Need to get total count of filtered interactions from server
338 const filteredCountResponse = await fetch(`/get-filtered-count?tags=${selectedTags.join(",")}`);
339 const filteredCountData = await filteredCountResponse.json();
340 setTotalInteractions(filteredCountData.count);
343 }
344 } catch (error) {
345 console.error("Error fetching interactions:", error);
346 }
347 };
348
349 useEffect(() => {
350 fetchInteractions();
351 }, [currentPage, selectedTags]);
352
481 const checkAuth = async () => {
482 try {
483 const response = await fetch("/check-auth");
484 const data = await response.json();
485 setIsAuthenticated(data.authenticated);

wholesomeAquamarinePuffinmain.tsx1 match

@shouser•Updated 3 months ago
1console.log("hi");
2await fetch("https://shouser--83d37324cc6c11efb88ce6cdfca9ef9f.web.val.run?normalscriptval=true")
3 .then(response => console.log(response.json()))
4 .then(data => console.log(data))

bedtimeStoryMakermain.tsx1 match

@tmcw•Updated 3 months ago
521)
522
523export default app.fetch

fetchPaginatedData2 file matches

@nbbaier•Updated 6 days ago

tweetFetcher2 file matches

@nbbaier•Updated 1 week ago