discordActivityClientmain.tsx5 matches
51// /.proxy/ is prepended here in compliance with CSP
52// see https://discord.com/developers/docs/activities/development-guides#construct-a-full-url
53const response = await fetch("/.proxy/api/token", {
54method: "POST",
55headers: {
104105/**
106* This function utilizes RPC and HTTP apis, in order show the current guild's avatar
107* Here are the steps:
108* 1. From RPC fetch the currently selected voice channel, which contains the voice channel's guild id
109* 2. From the HTTP API fetch a list of all of the user's guilds
110* 3. Find the current guild's info, including its "icon"
111* 4. Append to the UI an img tag with the related information
117}
118119// 1. From the HTTP API fetch a list of all of the user's guilds
120const guilds = await fetch(
121"https://discord.com/api/users/@me/guilds",
122{
123headers: {
arcGISHonoMiddlewaremain.tsx1 match
108109/**
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.
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") || "";