Back to APIs list

US Congress Stock Trading API examples & templates

Use these vals as a playground to view and fork US Congress Stock Trading API examples and templates on Val Town. Run any example below or find templates that can be used as a pre-built solution.
hvlck avatar
fetchReadable
@hvlck
Script
// inspired by https://www.val.town/v/stevekrouse/fetchJSON
pomdtr avatar
basicAuthV2
@pomdtr
Script
An interactive, runnable TypeScript val by pomdtr
ajax avatar
resumeHandler
@ajax
HTTP (deprecated)
Forked from iamseeley/resumeHandler
stevekrouse avatar
geoffApi
@stevekrouse
Script
An interactive, runnable TypeScript val by stevekrouse
stevekrouse avatar
val_town_client
@stevekrouse
Script
Forked from pomdtr/val_town_client
austinchappell avatar
myApi
@austinchappell
Script
An interactive, runnable TypeScript val by austinchappell
kuomory avatar
violetWarbler
@kuomory
HTTP (deprecated)
An interactive, runnable TypeScript val by kuomory
pomdtr avatar
getValVersion
@pomdtr
Script
Forked from neverstew/getValVersion
stevekrouse avatar
email
@stevekrouse
Script
Moved to @std.email .
neverstew avatar
finalUrl
@neverstew
HTTP (deprecated)
Final URL I keep getting tracking links as part of emails. They suck! Use Val Town as a tracking shield - call this val and get redirected to the final URL at the end of the redirection chain without picking up trackers along the way. https://neverstew-finalurl.web.val.run/<tracking_link> Example The Glastonbury registration lookup link. https://neverstew-finalurl.web.val.run/https://scke65qh.r.eu-west-1.awstrack.me/L0/https:%2F%2Fglastonbury.seetickets.com%2Fregistration%2Flookup/2/01020189fe6dd832-f894deea-eab7-4d1d-8c6a-0818e87ac95c-000000/8f6rVLcCc3v6CQNroYC81q9YkaU=335
postpostscript avatar
authMiddleware
@postpostscript
Script
authMiddleware: middleware to protect your HTTP val Todo [ ] Human readable JWT claim validation errors
pomdtr avatar
lastloginHono
@pomdtr
Script
See @pomdtr/lastlogin for more informations about the middleware Example /** @jsxImportSource npm:hono@3/jsx */ import { lastlogin } from "https://esm.town/v/pomdtr/lastloginHono"; import { verifyUserEmail } from "https://esm.town/v/pomdtr/verifyUserEmail" import { Hono } from "npm:hono"; const app = new Hono(); const lastloginMiddleware = lastlogin({ verifyEmail: verifyUserEmail }); // required for the auth pages to work app.use("/auth/*", lastloginMiddleware); // this page is public app.get("/", async (c) => { return c.html( <div> There is a secret message for you if you{" "}<a href="/secret">login</a> </div>, ); }); // this page requires the user to signup app.get("/secret", lastloginMiddleware, async (c) => { const email = c.req.header("X-User-Email"); return c.html( <div> I think {email} is a really silly email address, actually. </div>, ); }); export default app.fetch;
janpaul123 avatar
valle_tmp_5348120470989651484969606140059
@janpaul123
HTTP (deprecated)
// This val responds with an HTML form to input the user's name and greets them upon form submission
snptrs avatar
extractValInfo
@snptrs
Script
Forked from pomdtr/extractValInfo
jdan avatar
honoBasicAuthMiddleware
@jdan
Script
honoBasicAuthMiddleware You should use https://hono.dev/middleware/builtin/basic-auth instead. Used to authenticate your HTTP vals build with Hono behind a username/password challenge. Browsers store this information alongside your other passwords. Usage In basicAuthButton , I secure two routes (one for viewing a value, one for updating it) behind a username/password combo stores in my Env variables. /** @jsxImportSource npm:hono@3/jsx */ import { honoBasicAuthMiddleware } from "https://esm.town/v/jdan/honoBasicAuthMiddleware"; import { blob } from "https://esm.town/v/std/blob?v=12"; import { Hono } from "npm:hono"; /** Authenticate the URL */ const secretUsername = Deno.env.get("BUTTON_USERNAME"); const secretPassword = Deno.env.get("BUTTON_PASSWORD"); app.use(honoBasicAuthMiddleware(secretUsername, secretPassword)); app.get("/", async (c) => { const lastPressed = await blob.getJSON(blobStorageKey) || "Never"; return c.html( <div> <h1>Last Pressed: {lastPressed}</h1> <form method="POST" action="/press"> <input type="submit" /> </form> </div>, ); });
jollytoad avatar
helloWorld
@jollytoad
HTTP (deprecated)
Hello world server, using http functions . Try hitting URLs such as: /world , /world.txt , /world.json , /world.html , or even /<script>.html . This demonstrates how you can import and compose simple functions to construct a router to route based on various aspects of a request, ie. the URL path, method, and even on media-types based on path extension or the Accept header. See routing functions , and response helpers on JSR. For a more detailed guide on building a Deno app, including things like fs based routing, with these fns see... https://jollytoad.deno.dev/blog/http_getting_started