Search
val_vfbeq6V7yC
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export async function val_vfbeq6V7yC(req) {
try {
// Execute the code directly and capture its result
myApi
@zeitport
An interactive, runnable TypeScript val by zeitport
Script
export function myApi(name) {
return "hi " + name;
![chuyeow avatar](https://images.clerk.dev/oauth_github/img_2SvrkWlE25JjpPC0HSqJz1S6vi2.png)
myApi
@chuyeow
An interactive, runnable TypeScript val by chuyeow
Script
export function myApi(name) {
return "hi " + name;
cronTest
@lirenxn
An interactive, runnable TypeScript val by lirenxn
Script
export function cronTest() {
console.log("hello world");
return "hello world";
myApi
@johnfarrelldev
An interactive, runnable TypeScript val by johnfarrelldev
Script
export function myApi(name) {
return "hi " + name;
![stevekrouse avatar](https://images.clerk.dev/uploaded/img_2PqHa2Gsy93xQrjh2w78Xu0cChW.jpeg)
indigoOwl
@stevekrouse
An interactive, runnable TypeScript val by stevekrouse
Cron
import { monitored } from "https://esm.town/v/stevekrouse/sentry";
import delay from "npm:delay";
export default monitored(async function(interval: Interval) {
console.log(`Last run at ${interval.lastRunAt}`);
console.log("Starting 2s simulated job...");
alquranApiProxy
@rahil224
An interactive, runnable TypeScript val by rahil224
HTTP
export default async function server(request: Request): Promise<Response> {
// Extract the path after the first segment
const url = new URL(request.url);
myApi
@tahsin
An interactive, runnable TypeScript val by tahsin
Script
export function myApi(name) {
return "hi " + name;
val_l2VXZwPEB5
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export default async function handler(req) {
try {
const result = await (async () => {
function fibonacci() {
let a = 0, b = 1;
while (b < 1000) {
![wllmx avatar](https://images.clerk.dev/oauth_github/img_2QtLq9gm2MMvPysd2FpMBPh1chs.jpeg)
myApi
@wllmx
An interactive, runnable TypeScript val by wllmx
Script
export function myApi(name) {
return "hi " + name;
spaceximage
@moe
@jsxImportSource https://esm.sh/react
HTTP
import { ogImage } from "https://esm.town/v/moe/ogImage"
export default async function(req: Request): Promise<Response> {
// const data = await fetch("https://moe-spacexapi.web.val.run").then((res) => res.json())
return new Response(await homeImage(), { headers: { "Content-Type": "image/png" } })
export async function launchImage(l) {
return await ogImage(
</div>,
export async function homeImage() {
return await ogImage(
myApi
@steffen
An interactive, runnable TypeScript val by steffen
Script
export function myApi(name) {
return "hi " + name;
turso
@std
Deprecated in favor of std/sqlite (also powered by Turso) std/turso was the initial version of our integration with Turso. It was so popular, we rebuilt it to be faster and easier to use: std/sqlite . Turso is a serverless SQLite platform designed for the edge. It runs libSQL , their open contribution fork of SQLite. Every Val Town user automatically gets their own Turso SQLite database! It's great for >100kb data (ie bigger than a val) or when you need SQL: relations, ACID transactions, etc. Storage used in Turso will count against your Val Town total storage (10mb for free users; 1gb for Pro users). Contact us if you'd need more – it should be no problem! Getting started This val uses our public key auth scheme . Generate your keypair On your publicKey click the lock icon🔒 to change the permissions to Unlisted . Fork this helper function replacing stevekrouse with your own username Try out some queries! Usage This val returns a Turso SDK's Client , which supports execute , batch , and transaction . await @me.turso().execute(`create table blobs(
key text unique,
value text
)`) More example usage Architecture This @std.turso function is the client or SDK to @std.tursoAPI, which acts as a "proxy" to Turso. It handles authentication, creates databases, and forwards on your SQL queries. You can get lower latency (~200ms vs ~800ms), more storage, databases, CLI & API access by having your own Turso account.
Script
2. On [your publicKey](https://www.val.town/v/me/publicKey) click the lock icon🔒 to change the permissions to `Unlisted`.
3. [Fork this helper function](https://www.val.town/v/stevekrouse.turso/fork) replacing `stevekrouse` with your own username
4. [Try out some queries!](https://www.val.town/v/stevekrouse.tursoExamples/fork)
## Architecture
This @std.turso function is the client or SDK to @std.tursoAPI, which acts as a "proxy" to Turso. It handles authentication, creates databases, and forwards on your SQL queries. You can get lower latency (~200ms vs ~800ms), more storage, databases, CLI & API access by having your own Turso account.
type createClient = Awaited<ReturnType<typeof tursoImport>>["createClient"];
export function turso(keys, handle?) {
let val = "@std.tursoAPI";
tinygoHttp
@maxm
Class representing a BufferResult.
Script
return JSON.parse(new TextDecoder("utf8").decode(this.buffer));
function callHandlerWithString(
instance: WebAssembly.Instance,
return callHandlerWithBytes(instance, bytes);
function callHandlerWithJson(instance: WebAssembly.Instance, payload: any) {
const bytes = new TextEncoder("utf8").encode(JSON.stringify(payload));
const MASK = 2n ** 32n - 1n;
function callHandlerWithBytes(
instance: WebAssembly.Instance,
extractedBuffer[0] === 69,
async function handleRequest(
instance: WebAssembly.Instance,
headers: responseObj.headers,
export async function wasmHandler(wasmBytes: Uint8Array): Promise<(Request) => Promise<Response>> {
const init = async (wasmBytes: Uint8Array) => {