Val Town Code SearchReturn to Val Town

API Access

You can access search results via JSON API by adding format=json to your query:

https://codesearch.val.run/$%7Bsuccess?q=function&page=2524&format=json

For typeahead suggestions, use the /typeahead endpoint:

https://codesearch.val.run/typeahead?q=function

Returns an array of strings in format "username" or "username/projectName"

Found 28552 results for "function"(2697ms)

1// Response with "Hello World" on every HTTP request
2export default async function(req: Request): Promise<Response> {
3 return new Response("Hello World", { headers: { "Content-Type": "text/plain" } });
4}
1// This val responds to HTTP requests with "Hello, World!"
2export default async function main(req: Request): Promise<Response> {
3 return new Response("Hello, World!");
4}
1// This val responds with "Hello, World!" to all incoming HTTP requests
2
3export default async function main(req: Request): Promise<Response> {
4 return new Response("Hello, World!", { headers: { "Content-Type": "text/plain" } });
5}
1// This val responds with a funky "Hello, world!" HTML page with gradient background
2export default async function main(req: Request): Promise<Response> {
3 const html = `
4 <html>
1// This val responds with an HTML page styled with funky CSS gradients
2export default async function main(req: Request): Promise<Response> {
3 const htmlContent = `
4 <html>
1// This val responds with a styled "Hello, world!" in HTML with funky CSS gradients
2export default async function main(req: Request): Promise<Response> {
3 const htmlContent = `
4 <html>
1// This val responds with an HTML page styled with funky CSS gradients
2export default async function main(req: Request): Promise<Response> {
3 const html = `
4 <html>
1// This val responds with "Hello, world!"
2export default async function main(req: Request): Promise<Response> {
3 return new Response("Hello, world!");
4}
32};
33
34function renderComments(comments): string {
35 return comments
36 .map(
45}
46
47export default async function (req: Request): Promise<Response> {
48 const url = new URL(req.url);
49 const pathname = url.pathname;
65}
66
67function renderStoryPage(storyId: string): string {
68 const story = stories[storyId] || {
69 title: "Story Not Found",
107}
108
109function renderMainPage(): string {
110 return `
111<!DOCTYPE html>
41};
42
43function renderComments(comments: Comment[]): string {
44 return comments.map(comment => `
45 <div class="comment">
50}
51
52function renderStoryPage(storyId: string): string {
53 const story = stories[storyId] || { title: "Story Not Found", content: "The story you are looking for does not exist.", comments: [] };
54
88}
89
90function renderMainPage(): string {
91 const storyHtml = Object.entries(stories).map(([id, story]) => `
92 <div class="story">
126}
127
128export default async function(req: Request): Promise<Response> {
129 const url = new URL(req.url);
130 const pathname = url.pathname;

getFileEmail4 file matches

@shouser•Updated 1 month ago
A helper function to build a file's email
tuna

tuna8 file matches

@jxnblk•Updated 1 month ago
Simple functional CSS library for Val Town
lost1991
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": "*",
webup
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.