11let { query, dataRoutes } = createStaticHandler(routes);
12
13export async function handler(request: Request) {
14 // 1. run actions/loaders to get the routing context with `query`
15 let context = await query(request);
1/** @jsxImportSource https://esm.sh/react@18.2.0 */
2
3export default function Home() {
4 return <h1>This is just a test!</h1>;
5}
48await contentStore.init();
49
50function Town() {
51 return (
52 <div
69}
70
71function HomePage() {
72 return (
73 <html>
82 <form method="POST" action="/submit">
83 <textarea name="handler" rows={10} cols={50} autoFocus>
84 {`export default async function(req: Request) {
85 return Response.json("Hello, world!");
86}`}
95}
96
97function ContentPage({ handler, id }: { handler: string; id: string }) {
98 return (
99 <html>
122 let originalContent = textarea.value;
123
124 textarea.addEventListener('input', function() {
125 if (textarea.value !== originalContent) {
126 submitButton.style.display = 'inline-block';
20};
21
22export async function getSpotifyAccessToken(options: Partial<Options>): Promise<SpotifyAccessToken> {
23 const mergedOptions = {
24 ...defaultOptions,
5import { generateCodeAnthropic, makeFullPrompt } from "./backend/generateCode";
6
7function App() {
8 const [messages, setMessages] = useState<{ content: string; role: string }[]>([]);
9 const [inputMessage, setInputMessage] = useState("make a todo app");
11 const [bearerToken, _setBearerToken] = useState(localStorage.getItem("val-town-bearer"));
12
13 function setBearerToken(token: string) {
14 _setBearerToken(token);
15 localStorage.setItem("val-town-bearer", token);
79}
80
81function client() {
82 createRoot(document.getElementById("root")).render(<App />);
83}
84if (typeof document !== "undefined") { client(); }
85
86export default async function server(req: Request): Promise<Response> {
87 // console.log(req);
88 if (req.method === "POST") {
1export default async function(req: Request): Promise<Response> {
2 return Response.json({ ok: true });
3}
1export default function add(a: number, b: number) {
2 console.log(a);
3 return a + b;
1export default async function server(request: Request): Promise<Response> {
2 const url = new URL(request.url);
3 const params = url.searchParams;
5import { renderToString } from "npm:react-dom/server";
6
7function StatusRow({ rows }) {
8 return (
9 <div className="w-full flex flex-col space-y-2">
28}
29
30function StatusSection({ url, rows }) {
31 const sectionRows = rows.filter(row => row[0] === url);
32 const percentUp = Math.round((sectionRows.filter(row => row[1]).length / sectionRows.length) * 100);
44}
45
46export default async function(req: Request): Promise<Response> {
47 const { rows } = await sqlite.execute(
48 "https://esm.town/v/pablobarcos/isMyWebsiteDown",
2import { InvocationTracker } from 'https://esm.town/v/rozek/InvocationTracker'
3
4export default async function () {
5 const TestCases = [
6 /**** test constructor with valid inputs ****/
154/**** removeTable ****/
155
156 async function removeTable (TableName:string):Promise<void> {
157 console.log('(cleaning up)')
158 await sqlite.execute(
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": "*",