14## Usage
15
16This project preserves the functionality of the original vals with relative imports for better organization.
17
22}
23
24export function render<T>(
25 /** Root-level React component that renders an entire <html> element
26 * including the head and body tags.
41 }
42
43 return async function handler(request: Request): Promise<Response> {
44 const main = reactStream(Component, module);
45 const middleware: Middleware[] = [
76 module: string | false,
77): Middleware =>
78 async function(req: DataRequest, res: Response): Promise<Response> {
79 const { renderToReadableStream } = await import("https://esm.sh/react-dom@18.3.1/server");
80
65];
66
67export default async function redirectMiddleware(req: DataRequest, res: Response, next): Promise<Response> {
68 const match = paths.find(p => p.match(req.data.pathname));
69 // const match = paths.find(p => p.regex.match(req.data.pathname));
4import type { Middleware } from "https://esm.town/v/jxnblk/ReactStream";
5
6function generateRSSFeed(posts) {
7 return `
8 <rss version="2.0">
27}
28
29function escapeXml(unsafe) {
30 return unsafe.replace(/[<>&'"]/g, c => {
31 switch (c) {
36};
37
38async function getInitialProps(req: DataRequest, res: Response, next): Promise<Response> {
39 let params: Params = {};
40 let route: Route = Route.Home;
72}
73
74async function cacheHeaders(req: DataRequest, res: Response, next): Promise<Response> {
75 res.headers.set("Cache-Control", "max-age=31536000");
76 return next();
1export default async function(req: Request): Promise<Response> {
2 const url = new URL(req.url);
3 return fetch(
1export default async function(req: Request): Promise<Response> {
2 const url = new URL(req.url);
3 return fetch(new URL(url.pathname + url.search, "https://charmaine--5ad9e364-05c3-11f0-a042-569c3dd06744.web.val.run/"), {
1export default async function(req: Request): Promise<Response> {
2 const url = new URL(req.url);
3 return fetch(new URL(url.pathname + url.search, "https://charmaine--5ad9e364-05c3-11f0-a042-569c3dd06744.web.val.run/"), {
13## Usage
14
15This project preserves the functionality of the original vals with relative imports for better organization.
16
12const isProd = false;
13
14export async function twitterAlert({ lastRunAt }: Interval) {
15 // If isProd, search for tweets since that last time this interval ran
16 // if not, search for tweets since 48 hours ago for testing
Simple functional CSS library for Val Town
A helper function to build a file's email
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": "*",
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.