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
22}
23
24export function render<T>(
25 /** Root-level React component that renders an entire <html> element
26 * including the head and body tags.
37 // }
38
39 return async function handler(request: Request): Promise<Response> {
40 const main = reactRender(Component);
41 const middleware: Middleware[] = [
66 Component: React.ComponentType<ReactStreamProps>,
67): Middleware =>
68 async function(req: DataRequest, res: Response): Promise<Response> {
69 const { renderToStaticMarkup } = await import("https://esm.sh/react-dom@18.3.1/server");
70
7import { render, React } from "https://esm.town/v/jxnblk/ReactStatic";
8
9function App() {
10 return (
11 <html>
55```tsx
56// example middleware
57async function api (req: Request, res: Response, next): Promise<Response> {
58 if (req.pathname !== "/api") return next();
59 if (req.method === "POST") {
71```tsx
72// example middleware
73async function getInitialProps (req: Request, res: Response, next) {
74 // fetch data or do async work to pass as props to the component
75 req.data = {
88import { render } from "https://esm.town/v/jxnblk/ReactStatic";
89
90function App () {
91 return (
92 <html>
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
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 "select url, ok, duration, timestamp from uptime order by timestamp desc limit 200",
1import { db } from "https://esm.town/v/sqlite/db";
2
3export default async function(): Promise<Response> {
4 const res = await db.execute(
5 `SELECT author_username, count(*) as count
4import { createRoot } from "https://esm.sh/react-dom/client";
5
6function App() {
7 const [tipAmount, setTipAmount] = useState(5);
8 const paymentLinks = {
63}
64
65function Success() {
66 useEffect(() => {
67 confetti({
81}
82
83function client() {
84 const root = document.getElementById("root");
85 if (root) {
94if (typeof document !== "undefined") { client(); }
95
96export default async function server(request: Request): Promise<Response> {
97 const url = new URL(request.url);
98
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
23console.log("hi");
24// UTILS
25function generateJWT(userId: string) {
26 return new SignJWT({ userId }).setProtectedHeader({ alg: "HS256" }).sign(SECRET);
27}
28function verifyJWT(token: string) {
29 return jwtVerify(token, SECRET);
30}
31function generateRandomString() {
32 return Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
33}
34}
35
36async function detectTechnologies(email_address: string): Promise<ShovelResponse> {
37 const domain = email_address.split("@")[1];
38
57}
58
59export async function newUserWelcomeEmail(req: Request): Promise<Response> {
60 if (req.method === "GET") return html(welcomeEmail);
61 if (req.headers.get("clerkNonSensitive") !== Deno.env.get("clerkNonSensitive"))