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/$1?q=api&page=1392&format=json

For typeahead suggestions, use the /typeahead endpoint:

https://codesearch.val.run/typeahead?q=api

Returns an array of strings in format "username" or "username/projectName"

Found 17843 results for "api"(4860ms)

arcGISHonoMiddlewaremain.tsx1 match

@wiltUpdated 7 months ago
108
109/**
110 * Converts parameters to the proper representation to send to the ArcGIS REST API.
111 * @param params The object whose keys will be encoded.
112 * @return A new object with properly encoded values.

arcGISHonoMiddlewareREADME.md1 match

@wiltUpdated 7 months ago
1Copy of [ArcGISIdentityManager.authorize()](https://github.com/Esri/arcgis-rest-js/blob/bfd7ce977d9879077e92fabfc491240d8f230844/packages/arcgis-rest-request/src/ArcGISIdentityManager.ts#L760), OAuth2 authentication for the ESRI ArcGIS API which is implemented as Express middleware, ported to Hono.
2
3Migrated from folder: gisc/arcGISHonoMiddleware

evalUImain.tsx1 match

@maxmUpdated 7 months ago
47 <pre><code id="resultCode"></code></pre>
48 </div>
49 <h2>API Documentation</h2>
50 <p>To use the POST endpoint programmatically, send a POST request to this URL with the TypeScript code in the request body.</p>
51 <h3>Curl Example:</h3>

falDemoAppmain.tsx2 matches

@stevekrouseUpdated 7 months ago
15 try {
16 const fal = createFalClient({
17 proxyUrl: "/api/fal/proxy",
18 });
19
139 }
140
141 if (url.pathname === "/api/fal/proxy") {
142 return falProxyRequest(req);
143 }

falDemoAppmain.tsx2 matches

@stevekrouseUpdated 7 months ago
15 try {
16 const fal = createFalClient({
17 proxyUrl: "/api/fal/proxy",
18 });
19
139 }
140
141 if (url.pathname === "/api/fal/proxy") {
142 return falProxyRequest(req);
143 }

prodigiousTanTurtlemain.tsx19 matches

@ocholap9Updated 7 months ago
111 const handleSubmit = async (e) => {
112 e.preventDefault();
113 const response = await fetch('/api/login', {
114 method: 'POST',
115 headers: { 'Content-Type': 'application/json' },
146 const handleSubmit = async (e) => {
147 e.preventDefault();
148 const response = await fetch('/api/register', {
149 method: 'POST',
150 headers: { 'Content-Type': 'application/json' },
181 const handleSubmit = async (e) => {
182 e.preventDefault();
183 const response = await fetch('/api/profile', {
184 method: 'PUT',
185 headers: {
230
231 const fetchVehicles = async () => {
232 const response = await fetch('/api/vehicles', {
233 headers: { 'Authorization': `Bearer ${localStorage.getItem('token')}` },
234 });
240
241 const fetchTransactions = async () => {
242 const response = await fetch('/api/transactions', {
243 headers: { 'Authorization': `Bearer ${localStorage.getItem('token')}` },
244 });
279
280 const fetchTollBooths = async () => {
281 const response = await fetch('/api/toll-booths', {
282 headers: { 'Authorization': `Bearer ${localStorage.getItem('token')}` },
283 });
317
318 const fetchRevenueReport = async () => {
319 const response = await fetch('/api/revenue-report', {
320 headers: { 'Authorization': `Bearer ${localStorage.getItem('token')}` },
321 });
327
328 const fetchTrafficAnalytics = async () => {
329 const response = await fetch('/api/traffic-analytics', {
330 headers: { 'Authorization': `Bearer ${localStorage.getItem('token')}` },
331 });
364 const { pathname } = new URL(request.url);
365
366 if (pathname.startsWith('/api/')) {
367 return handleApiRequest(request);
368 }
369
391}
392
393async function handleApiRequest(request: Request): Promise<Response> {
394 const { pathname } = new URL(request.url);
395 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
446
447 switch (pathname) {
448 case '/api/register':
449 return handleRegister(request, sqlite, KEY, SCHEMA_VERSION);
450 case '/api/login':
451 return handleLogin(request, sqlite, KEY, SCHEMA_VERSION);
452 case '/api/profile':
453 return handleProfile(request, sqlite, KEY, SCHEMA_VERSION, jwtDecode);
454 case '/api/vehicles':
455 return handleVehicles(request, sqlite, KEY, SCHEMA_VERSION, jwtDecode);
456 case '/api/transactions':
457 return handleTransactions(request, sqlite, KEY, SCHEMA_VERSION, jwtDecode);
458 case '/api/toll-booths':
459 return handleTollBooths(request, sqlite, KEY, SCHEMA_VERSION, jwtDecode);
460 case '/api/revenue-report':
461 return handleRevenueReport(request, sqlite, KEY, SCHEMA_VERSION, jwtDecode);
462 case '/api/traffic-analytics':
463 return handleTrafficAnalytics(request, sqlite, KEY, SCHEMA_VERSION, jwtDecode);
464 default:

sqliteExplorerAppmain.tsx2 matches

@robaggioUpdated 7 months ago
27 <head>
28 <title>SQLite Explorer</title>
29 <link rel="preconnect" href="https://fonts.googleapis.com" />
30
31 <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
32 <link
33 href="https://fonts.googleapis.com/css2?family=Fira+Code:wght@300..700&family=Source+Sans+3:ital,wght@0,200..900;1,200..900&display=swap"
34 rel="stylesheet"
35 />

sqliteExplorerAppREADME.md1 match

@robaggioUpdated 7 months ago
13## Authentication
14
15Login to your SQLite Explorer with [password authentication](https://www.val.town/v/pomdtr/password_auth) with your [Val Town API Token](https://www.val.town/settings/api) as the password.
16
17## Todos / Plans

whoIsHiringmain.tsx4 matches

@lowluUpdated 7 months ago
63 const fetchStories = async () => {
64 try {
65 const response = await fetch("/api/stories");
66 if (!response.ok) throw new Error("Failed to fetch dates");
67 const data = await response.json();
77 try {
78 dispatch({ type: "loading", value: true });
79 const response = await fetch(`/api/comments?query=${encodeURIComponent(query)}&story=${story}&page=${page}`);
80 if (!response.ok) throw new Error("Failed to fetch comments");
81 const data = await response.json();
387export default async function(req: Request): Promise<Response> {
388 const url = new URL(req.url);
389 if (url.pathname === "/api/stories") {
390 const storySearch = await hnSearch({
391 search_by_date: true,
408 }
409
410 if (url.pathname === "/api/comments") {
411 const params = url.searchParams;
412 const query = params.get("query") || "";

diligentSapphireOrcamain.tsx13 matches

@gigmxUpdated 7 months ago
2 const url = new URL(req.url);
3
4 // Proxy endpoint to handle API requests
5 if (url.pathname === "/api/proxy") {
6 try {
7 const body = await req.json();
8 const apiResponse = await fetch("http://57.132.138.13:1865/message", {
9 method: "POST",
10 headers: {
14 });
15
16 if (!apiResponse.ok) {
17 throw new Error(`API responded with status: ${apiResponse.status}`);
18 }
19
20 const data = await apiResponse.json();
21 return new Response(JSON.stringify(data), {
22 headers: {
35
36 // Health check proxy endpoint
37 if (url.pathname === "/api/health") {
38 try {
39 const apiResponse = await fetch("http://57.132.138.13:1865/");
40 return new Response(null, {
41 status: apiResponse.ok ? 200 : 500
42 });
43 } catch (error) {
108 <div id="connection-status" class="text-center p-2 mb-4 hidden">
109 <span class="bg-yellow-100 bg-opacity-90 text-yellow-800 px-4 py-2 rounded-full text-sm shadow-lg">
110 ⚠️ Cannot connect to Cheshire Cat API. Please try again later.
111 </span>
112 </div>
246 }
247
248 // Test API connection through proxy
249 fetch("/api/health")
250 .then(response => {
251 if (!response.ok) throw new Error();
290
291 try {
292 const response = await fetch("/api/proxy", {
293 method: "POST",
294 headers: {

dailyQuoteAPI

@SoukyUpdated 21 hours ago

HTTP

@NcharityUpdated 23 hours ago
Daily Quote API
apiry
Kapil01