blobbyFacemain.tsx18 matches
2import { blobby } from "https://esm.town/v/yawnxyz/blobby";
3import { fileTypeFromBuffer } from 'npm:file-type';
4import { modifyFetchHandler } from "https://esm.town/v/andreterron/codeOnValTown?v=50";
5import { cors } from "npm:hono/cors";
6757677// Endpoint to fetch blob by key
78app.get("/blob/:key", async (c) => {
79const key = c.req.param('key');
219this.blobs[key] = {isLoading: true};
220
221const response = await fetch('/blob/' + key);
222const contentType = response.headers.get('Content-Type');
223blob.type = contentType || 'text/plain';
249let blob = this.blobs[key];
250try {
251const response = await fetch('/create/' + key, {
252method: 'POST',
253headers: {
273274// Send a delete request to the server
275const response = await fetch('/delete/' + key, { method: 'GET' });
276277// Check the response status
343
344try {
345const response = await fetch('/upload/' + key, {
346method: 'POST',
347body: formData,
368
369try {
370const response = await fetch('/uploadUrl' + '?key=' + key + '&url=' + url);
371
372if (!response.ok) {
391if (!this.newKeyName) return;
392try {
393const response = await fetch('/rename?key='+key+'&newKey='+this.newKeyName);
394if (!response.ok) {
395throw new Error('Failed to rename blob');
559async loadBlob() {
560this.isLoading = true;
561const response = await fetch('/blob/' + this.key);
562const contentType = response.headers.get('Content-Type');
563this.blobType = contentType || 'text/plain';
583async updateCreate() {
584try {
585const response = await fetch('/create/' + this.key, {
586method: 'POST',
587headers: {
606607try {
608const response = await fetch('/upload/' + this.key, {
609method: 'POST',
610body: formData,
626if (this.uploadUrl) {
627try {
628const response = await fetch('/uploadUrl?key=' + this.key + '&url=' + this.uploadUrl);
629630if (!response.ok) {
643if (!this.newKeyName) return;
644try {
645const response = await fetch('/rename?key=' + this.key + '&newKey=' + this.newKeyName);
646if (!response.ok) {
647throw new Error('Failed to rename blob');
661}
662try {
663const response = await fetch('/delete/' + this.key, { method: 'GET' });
664if (!response.ok) {
665throw new Error('Failed to delete blob');
763764765export default app.fetch;
766767// import { verifyToken } from "https://esm.town/v/pomdtr/verifyToken";
770771772// export default passwordAuth(app.fetch);
773774// export default passwordAuth(app.fetch, { verifyPassword: verifyToken });
775// export default passwordAuth(app.fetch, { verifyPassword: (password) => password == "yespleasetakealook" });
776// }, { verifyPassword: (password) => password == Deno.env.get("VAL_PASSWORD") });
777
6465try {
66const response = await fetch('${httpEndpoint}', {
67method: 'POST',
68body: code,
fearlessVioletAnteatermain.tsx5 matches
42e.preventDefault();
43const finalAmount = showCustomAmount ? parseFloat(customAmount) : amount;
44const response = await fetch("/create-checkout-session", {
45method: "POST",
46headers: { "Content-Type": "application/json" },
205206useEffect(() => {
207fetchPayments();
208const urlParams = new URLSearchParams(window.location.search);
209if (urlParams.get('success') === 'true') {
212}, []);
213214const fetchPayments = async () => {
215const response = await fetch('/get-payments');
216const data = await response.json();
217setPayments(data);
223<div className="w-full max-w-[90%] flex flex-col md:flex-row gap-8">
224<div className="w-full md:w-1/2 order-2 md:order-1">
225<TippingForm onPaymentSuccess={fetchPayments} />
226</div>
227<div className="w-full md:w-1/2 order-1 md:order-2">
prodigiousTanTurtlemain.tsx18 matches
111const handleSubmit = async (e) => {
112e.preventDefault();
113const response = await fetch('/api/login', {
114method: 'POST',
115headers: { 'Content-Type': 'application/json' },
146const handleSubmit = async (e) => {
147e.preventDefault();
148const response = await fetch('/api/register', {
149method: 'POST',
150headers: { 'Content-Type': 'application/json' },
181const handleSubmit = async (e) => {
182e.preventDefault();
183const response = await fetch('/api/profile', {
184method: 'PUT',
185headers: {
225226useEffect(() => {
227fetchVehicles();
228fetchTransactions();
229}, []);
230231const fetchVehicles = async () => {
232const response = await fetch('/api/vehicles', {
233headers: { 'Authorization': `Bearer ${localStorage.getItem('token')}` },
234});
239};
240241const fetchTransactions = async () => {
242const response = await fetch('/api/transactions', {
243headers: { 'Authorization': `Bearer ${localStorage.getItem('token')}` },
244});
275276useEffect(() => {
277fetchTollBooths();
278}, []);
279280const fetchTollBooths = async () => {
281const response = await fetch('/api/toll-booths', {
282headers: { 'Authorization': `Bearer ${localStorage.getItem('token')}` },
283});
312313useEffect(() => {
314fetchRevenueReport();
315fetchTrafficAnalytics();
316}, []);
317318const fetchRevenueReport = async () => {
319const response = await fetch('/api/revenue-report', {
320headers: { 'Authorization': `Bearer ${localStorage.getItem('token')}` },
321});
326};
327328const fetchTrafficAnalytics = async () => {
329const response = await fetch('/api/traffic-analytics', {
330headers: { 'Authorization': `Bearer ${localStorage.getItem('token')}` },
331});
fastCoffeeLizardmain.tsx5 matches
126127<script>
128async function fetchData() {
129try {
130const response = await fetch(window.location.href, { headers: { 'accept': 'application/json' } });
131const data = await response.json();
132136thermometerFill.style.width = percentage + "%";
137} catch (error) {
138console.error('Error fetching data:', error);
139}
140}
141142fetchData(); // Fetch data on page load
143</script>
144</body>
161});
162} catch (error) {
163console.error("Error fetching data:", error);
164return new Response(`Error: ${error.message}`, { status: 500 });
165}
sqliteExplorerAppmain.tsx4 matches
1/** @jsxImportSource https://esm.sh/hono@latest/jsx **/
23import { modifyFetchHandler } from "https://esm.town/v/andreterron/codeOnValTown?v=50";
4import { iframeHandler } from "https://esm.town/v/nbbaier/iframeHandler";
5import { resetStyle } from "https://esm.town/v/nbbaier/resetStyle";
16import { sqliteStyle } from "https://esm.town/v/robaggio/sqliteStyle";
17import { ResultSet, sqlite } from "https://esm.town/v/std/sqlite";
18import { reloadOnSaveFetchMiddleware } from "https://esm.town/v/stevekrouse/reloadOnSave";
19import { Hono } from "npm:hono";
20import type { FC } from "npm:hono/jsx";
175});
176177export const handler = app.fetch;
178export default iframeHandler(modifyFetchHandler(passwordAuth(handler, { verifyPassword: verifyToken })));
whoIsHiringmain.tsx12 matches
61}, [state.loading, state.hasMore]);
6263const fetchStories = async () => {
64try {
65const response = await fetch("/api/stories");
66if (!response.ok) throw new Error("Failed to fetch dates");
67const data = await response.json();
68setStories(data);
70}
71catch (err) {
72console.error("Error fetching stories:", err);
73}
74};
7576const fetchComments = async (query: string, story: string, page: number) => {
77try {
78dispatch({ type: "loading", value: true });
79const response = await fetch(`/api/comments?query=${encodeURIComponent(query)}&story=${story}&page=${page}`);
80if (!response.ok) throw new Error("Failed to fetch comments");
81const data = await response.json();
82setComments(prevComments => page === 1 ? data.hits : [...prevComments, ...data.hits]);
84dispatch({ type: "loading", value: false });
85} catch (err) {
86console.error("Error fetching comments:", err);
87dispatch({ type: "loading", value: false });
88}
99dispatch({ type: "hasMore", value: true });
100dispatch({ type: "query", value: newQuery });
101fetchComments(fullQuery, state.story, 1);
102};
103104useEffect(() => {
105fetchStories();
106107const handleScroll = () => {
122: "";
123const fullQuery = `${filtersQuery} ${state.query}`;
124fetchComments(fullQuery, state.story, state.page);
125}
126}
418tags: `comment, story_${story}`,
419page: 0,
420hitsPerPage: 100, // Fetch a moderate number of comments
421});
422
diligentSapphireOrcamain.tsx4 matches
6try {
7const body = await req.json();
8const apiResponse = await fetch("http://57.132.138.13:1865/message", {
9method: "POST",
10headers: {
37if (url.pathname === "/api/health") {
38try {
39const apiResponse = await fetch("http://57.132.138.13:1865/");
40return new Response(null, {
41status: apiResponse.ok ? 200 : 500
247
248// Test API connection through proxy
249fetch("/api/health")
250.then(response => {
251if (!response.ok) throw new Error();
290
291try {
292const response = await fetch("/api/proxy", {
293method: "POST",
294headers: {
wittyTurquoiseDovemain.tsx7 matches
205206useEffect(() => {
207fetchSavedSnippets();
208}, []);
209210async function fetchSavedSnippets() {
211const response = await fetch("/snippets");
212const snippets = await response.json();
213setSavedSnippets(snippets);
216async function handleSave() {
217if (!code) return;
218const response = await fetch("/snippets", {
219method: "POST",
220headers: { "Content-Type": "application/json" },
222});
223if (response.ok) {
224fetchSavedSnippets();
225}
226}
227228async function handleDelete(id: number) {
229const response = await fetch(`/snippets/${id}`, { method: "DELETE" });
230if (response.ok) {
231setSavedSnippets(snippets => snippets.filter(s => s.id !== id));
238239try {
240const response = await fetch("/", {
241method: "POST",
242body: JSON.stringify({ prompt, currentCode: code }),
zwiftPortalScheduleREADME.md1 match
1Fetch and parse the Zwift Climbing Portal Schedule XML from the Zwift CDN.
23Example usage: