Search

Results include substring matches and semantically similar vals. Learn more
ajax avatar
resumeWebsite
@ajax
An interactive, runnable TypeScript val by ajax
Script
import { resumeHtml } from "https://esm.town/v/ajax/resumeHtml";
export function resumeWebsite(req, res) {
res.set("Content-Type", "text/html");
res.send(resumeHtml);
rvorias avatar
turquoiseLlama
@rvorias
An interactive, runnable TypeScript val by rvorias
HTTP (deprecated)
const gist =
"https://gist.githubusercontent.com/rvorias/2af68a5974bdbebba5925bbdba52c07d/raw/4320ade50bcccd020127db24607ca4fac71ff0f6/d
export const queryParams = async (req: Request) => {
const data = await fetch(gist);
const jsonData = await data.json();
const searchParams = new URL(req.url).searchParams;
const params = Object.fromEntries(searchParams.entries());
const id = parseInt(params["id"]) - 1;
const code = jsonData["data"][id];
let ans;
jessmartin avatar
getPocket
@jessmartin
An interactive, runnable TypeScript val by jessmartin
Script
import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
export function getPocket(params) {
return fetchJSON("https://getpocket.com/v3/get", {
method: "POST",
body: JSON.stringify(params),
camdenclark avatar
honoExample
@camdenclark
An interactive, runnable TypeScript val by camdenclark
HTTP (deprecated)
import { Hono } from "npm:hono@3";
const app = new Hono();
app.get("/", (c) => c.text("Hello from Hono!"));
app.get("/yeah", (c) => c.text("Routing!"));
export default app.fetch;
alp avatar
proxyFetch1
@alp
An interactive, runnable TypeScript val by alp
Script
import { fetch } from "https://esm.town/v/std/fetch";
export const proxyFetch1 = async (req, res) => {
const { url, options } = req.body;
try {
const response = await fetch(url, options);
return res.status(response.status).send(await response.text());
} catch (e) {
const errorMessage = e instanceof Error ? e.message : "Unknown error";
console.error("Failed to initiate fetch", e);
return res.status(500).send(`Failed to initiate fetch: ${errorMessage}`);
tempdev avatar
primewire
@tempdev
An interactive, runnable TypeScript val by tempdev
Script
const NotFoundError = Error;
primewireApiKey,
primewireBase,
} from "https://raw.githubusercontent.com/Ciarands/mw-providers/dev/src/providers/sources/primewire/common.ts";
async function search(imdbId: string) {
const searchResult = await fetch(`${primewireBase}/api/v1/show?key=${primewireApiKey}&imdb_id=${imdbId}`);
return await searchResult.json().then((searchResult) => {
return searchResult.id;
async function getStreams(title: string) {
const titlePage = load(title);
vtdocs avatar
saveFormData
@vtdocs
An interactive, runnable TypeScript val by vtdocs
Script
let { submittedEmailAddresses } = await import("https://esm.town/v/vtdocs/submittedEmailAddresses");
export const saveFormData = async (req: express.Request, res: express.Response) => {
// Create somewhere to store data if it doesn't already exist
if (submittedEmailAddresses === undefined) {
submittedEmailAddresses = [];
// Pick out the form data
const emailAddress = req.body.email;
if (submittedEmailAddresses.includes(emailAddress)) {
return res.send("you're already signed up!");
await email({
fields avatar
defineSlackApp
@fields
An interactive, runnable TypeScript val by fields
Script
export let defineSlackApp = async (req: express.Request, res: express.Response) => {
const text = req.body.text.trim();
res.status(200);
// /undefine
if (req.body.command == "/undefine") {
if (dictionary[text.toLowerCase()]) {
delete dictionary[text.toLowerCase()];
res.send(`Removed definition for *${text}*`);
res.send(`There is no definition for *${text}*`);
return;
tal avatar
fetchAndStore
@tal
An interactive, runnable TypeScript val by tal
Script
export async function fetchAndStore(opts: {
schoolYear: `${number}-${number}`;
month: string;
menuType: string;
const menuText = await fetchDOEMenu(opts);
const lines: ReturnType<typeof parseMenuLine>[] = await Promise
.all(menuText.split("\r\n").map(parseMenuLine));
const key = dateCalendarKey(opts);
doeMenuResponseStore[key] = {
lastFetchedAt: new Date(),
janpaul123 avatar
valle_tmp_318720770269803174245544142195994
@janpaul123
// This val will respond with "Hello, world!" to any HTTP request
HTTP (deprecated)
// This val will respond with "Hello, world!" to any HTTP request
export default async function (req: Request): Promise<Response> {
return new Response("Hello, world!");
iamseeley avatar
exampleTranslation
@iamseeley
An interactive, runnable TypeScript val by iamseeley
HTTP (deprecated)
export default async function handler(req) {
if (req.method === "GET") {
return new Response(`
<!DOCTYPE html>
<html>
<body>
<h2>Translate English to German</h2>
<form id="translationForm">
<label for="text">English Text:</label><br>
<input type="text" id="text" name="text"><br><br>
leomp12 avatar
MyFooter
@leomp12
Fork this if you want to share random vals from your likes in your projects!
HTTP (deprecated)
Fork this if you want to share random vals from your likes in your projects!
const USERNAME = extractValInfo(import.meta.url).author;
const hello = Deno.env.get("HELLO_WORLD");
export async function MyFooter(logo = valTownLogoAuto) {
const recommendation = rootValRef().handle === USERNAME
? html`<span class="recommends">${await recommends()}</span>`
return html`
<footer>
Made by
<a href="https://val.town/u/${USERNAME}" target="_blank">@${USERNAME}</a>
antonnyman avatar
forbud
@antonnyman
An interactive, runnable TypeScript val by antonnyman
HTTP (deprecated)
export const forbud = async (req: Request) => {
let counties = [
county: "Blekinge",
municipalities: [
key: "Karlshamn",
value: "",
key: "Karlskrona",
value: "",
key: "Olofström",
value: "",
mehmet avatar
testPostCall
@mehmet
An interactive, runnable TypeScript val by mehmet
Script
import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
export async function testPostCall() {
const result = await fetchJSON(
"https://api.val.town/express/@stevekrouse.postWebhook1",
method: "POST",
body: JSON.stringify({ name: "Steve" }),
console.email(JSON.stringify(result), "testPostResult");
generatecoll avatar
greenLobster
@generatecoll
HTML example This is an example of how to return an HTML response. You can also preview it at https://andreterron-htmlExample.web.val.run?name=Andre
HTTP (deprecated)
# HTML example
This is an example of how to return an HTML response.
You can also preview it at https://andreterron-htmlExample.web.val.run?name=Andre
// View at https://andreterron-htmlExample.web.val.run?name=Andre
export default async function(req: Request): Promise<Response> {
const query = new URL(req.url).searchParams;
// Read name from the querystring or body. Defaults to "you" if not present.
const name = query.get("name") || (await req.json().catch(() => ({}))).name || "you";
// Returns the HTML response
return new Response(`<h1>Hi!</h1>`, {