1// https://api.val.town/v1/express/zzz.IP
2export async function IP(req, res) {
3 const ip = req.get("true-client-ip") ??
4 req.get("x-forwarded-for")?.split(",")[0];
1import { runVal } from "https://esm.town/v/std/runVal";
2
3export async function rime(req, res) {
4 const url = req.url;
5 const { text = "Hello World" } = req.query;
1import { hello_users } from "https://esm.town/v/ralfw/hello_users";
2
3export function Hello(name: string) {
4 hello_users.push(name);
5 const n = hello_users.filter((x) => x == name).length;
1export function myApi(name) {
2 return { "name": name };
3}
1export function myApi(name) {
2 return "hi " + name;
3}
1import { h as h2 } from "https://esm.town/v/tmcw/h";
2
3export function h(tagName: string, attrsPlus?: any, ...children: any[]) {
4 if (!attrsPlus) attrsPlus = {};
5 if (attrsPlus.isEl || typeof attrsPlus === "string")
28 .join("");
29 const attrsToEmit = Object.entries(attrsPlus).reduce((acc: any, [k, v]) => {
30 if (k.startsWith("on") && typeof v === "function") return acc; // Skip events
31 if (v === null || v === undefined) return acc; // Skip null/undefined
32 if (typeof v === "function") v = v(); // Allow dynamic stuff (continue to rest of function)
33 if (k === "innerHTML") innerHtml = String(v);
34 else if (k === "innerText") innerHtml = text2Html(String(v));
1import { valTownTeam } from "https://esm.town/v/stevekrouse/valTownTeam";
2
3export function isValTownTeam(handle) {
4 return valTownTeam.includes(handle.replace("@", ""));
5}
1import { fetchText } from "https://esm.town/v/stevekrouse/fetchText";
2
3export async function valTownBlogJSON(): Promise<Blog[]> {
4 let { parse } = await import("npm:node-html-parser");
5 const text = await fetchText("https://blog.val.town");
1export function myApi(name) {
2 return "hi " + name;
3}
1export function myName() {
2 return "Jake Singer";
3}
A helper function to build a file's email
Simple functional CSS library for Val Town
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.
import { OpenAI } from "https://esm.town/v/std/openai";
export default async function(req: Request): Promise<Response> {
if (req.method === "OPTIONS") {
return new Response(null, {
headers: {
"Access-Control-Allow-Origin": "*",