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.
23Migrated from folder: gisc/arcGISHonoMiddleware
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
15try {
16const fal = createFalClient({
17proxyUrl: "/api/fal/proxy",
18});
19139}
140141if (url.pathname === "/api/fal/proxy") {
142return falProxyRequest(req);
143}
falDemoAppmain.tsx2 matches
15try {
16const fal = createFalClient({
17proxyUrl: "/api/fal/proxy",
18});
19139}
140141if (url.pathname === "/api/fal/proxy") {
142return falProxyRequest(req);
143}
prodigiousTanTurtlemain.tsx19 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: {
230231const fetchVehicles = async () => {
232const response = await fetch('/api/vehicles', {
233headers: { 'Authorization': `Bearer ${localStorage.getItem('token')}` },
234});
240241const fetchTransactions = async () => {
242const response = await fetch('/api/transactions', {
243headers: { 'Authorization': `Bearer ${localStorage.getItem('token')}` },
244});
279280const fetchTollBooths = async () => {
281const response = await fetch('/api/toll-booths', {
282headers: { 'Authorization': `Bearer ${localStorage.getItem('token')}` },
283});
317318const fetchRevenueReport = async () => {
319const response = await fetch('/api/revenue-report', {
320headers: { 'Authorization': `Bearer ${localStorage.getItem('token')}` },
321});
327328const fetchTrafficAnalytics = async () => {
329const response = await fetch('/api/traffic-analytics', {
330headers: { 'Authorization': `Bearer ${localStorage.getItem('token')}` },
331});
364const { pathname } = new URL(request.url);
365
366if (pathname.startsWith('/api/')) {
367return handleApiRequest(request);
368}
369391}
392393async function handleApiRequest(request: Request): Promise<Response> {
394const { pathname } = new URL(request.url);
395const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
446447switch (pathname) {
448case '/api/register':
449return handleRegister(request, sqlite, KEY, SCHEMA_VERSION);
450case '/api/login':
451return handleLogin(request, sqlite, KEY, SCHEMA_VERSION);
452case '/api/profile':
453return handleProfile(request, sqlite, KEY, SCHEMA_VERSION, jwtDecode);
454case '/api/vehicles':
455return handleVehicles(request, sqlite, KEY, SCHEMA_VERSION, jwtDecode);
456case '/api/transactions':
457return handleTransactions(request, sqlite, KEY, SCHEMA_VERSION, jwtDecode);
458case '/api/toll-booths':
459return handleTollBooths(request, sqlite, KEY, SCHEMA_VERSION, jwtDecode);
460case '/api/revenue-report':
461return handleRevenueReport(request, sqlite, KEY, SCHEMA_VERSION, jwtDecode);
462case '/api/traffic-analytics':
463return handleTrafficAnalytics(request, sqlite, KEY, SCHEMA_VERSION, jwtDecode);
464default:
sqliteExplorerAppmain.tsx2 matches
27<head>
28<title>SQLite Explorer</title>
29<link rel="preconnect" href="https://fonts.googleapis.com" />
3031<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
32<link
33href="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"
34rel="stylesheet"
35/>
sqliteExplorerAppREADME.md1 match
13## Authentication
1415Login 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.
1617## Todos / Plans
whoIsHiringmain.tsx4 matches
63const fetchStories = async () => {
64try {
65const response = await fetch("/api/stories");
66if (!response.ok) throw new Error("Failed to fetch dates");
67const data = await response.json();
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();
387export default async function(req: Request): Promise<Response> {
388const url = new URL(req.url);
389if (url.pathname === "/api/stories") {
390const storySearch = await hnSearch({
391search_by_date: true,
408}
409410if (url.pathname === "/api/comments") {
411const params = url.searchParams;
412const query = params.get("query") || "";
diligentSapphireOrcamain.tsx13 matches
2const url = new URL(req.url);
3
4// Proxy endpoint to handle API requests
5if (url.pathname === "/api/proxy") {
6try {
7const body = await req.json();
8const apiResponse = await fetch("http://57.132.138.13:1865/message", {
9method: "POST",
10headers: {
14});
15
16if (!apiResponse.ok) {
17throw new Error(`API responded with status: ${apiResponse.status}`);
18}
19
20const data = await apiResponse.json();
21return new Response(JSON.stringify(data), {
22headers: {
3536// Health check proxy endpoint
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
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
249fetch("/api/health")
250.then(response => {
251if (!response.ok) throw new Error();
290
291try {
292const response = await fetch("/api/proxy", {
293method: "POST",
294headers: {
simpletextmain.tsx2 matches
16<meta name="viewport" content="width=device-width, initial-scale=1.0">
17<title>${blogTitle}</title>
18<link rel="preconnect" href="https://fonts.googleapis.com">
19<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
20<link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;1,100;1,200;1,300;1,400;1,500;1,600;1,700&display=swap" rel="stylesheet">
21<style>
22@view-transition { navigation: auto; }