hello_worldfileCreated.ts1 match
1export default async function(req: Request): Promise<Response> {
2try {
3if (req.method !== "POST") {
static_reactdemo.http.tsx1 match
4import reactRender from "./react-render.tsx";
56function Demo () {
7return (
8<html>
static_reactindex.tsx2 matches
3export type Middleware = (req: DataRequest, res: Response, callback: NextCallback) => Promise<Response>;
45export function render<T>(...args: Middleware[]) {
6const middleware: Middleware[] = args.slice().filter(Boolean);
78return async function handler(request: Request): Promise<Response> {
910let res: Response = new Response();
107];
108109export default async function(interval: Interval) {
110try {
111const news = await updateNews(sources);
static_reactreact-render.tsx1 match
56export const reactRender = (Component: React.ComponentType) => {
7return async function (req: DataRequest, res: Response): Promise<Response> {
8const html = renderToStaticMarkup(<Component />);
9const headers = res.headers;
4export const projectStatesTableName = "project_creation_project_states";
56export async function createTables() {
7await sqlite.batch([
8`CREATE TABLE IF NOT EXISTS ${subscriptionsTableName} (
1export async function sendWebhookNotification(url: string, data: any) {
2try {
3const response = await fetch(url, {
project_updates_webhookqueries.ts4 matches
10await createTables();
1112export async function getWebhooks(limit = WEBHOOK_LIMIT): Promise<Webhook[]> {
13const webhooks = await sqlite.execute(
14`SELECT * FROM ${subscriptionsTableName}
20}
2122export async function insertWebhook(projectId: string, webhookUrl: string, event: string) {
23await sqlite.execute(
24`INSERT INTO ${subscriptionsTableName} (projectId, webhookUrl, event)
28}
2930export async function getProjectState(projectId: string) {
31const result = await sqlite.execute(
32`SELECT * FROM ${projectStatesTableName}
47}
4849export async function updateProjectState(projectId: string, files: any[]) {
50await sqlite.execute(
51`INSERT OR REPLACE INTO ${projectStatesTableName} (projectId, files, lastUpdated)
25const cx = (...cn) => cn.filter(Boolean).join(" ");
2627export function App(props) {
28const cookies: AppCookies = parseCookies(props.cookie || null);
29const initColorIndex = cookies.color || 0;
61// TODO: 404
6263function Head(props) {
64const { post } = props.data;
65let params = "";
106const S = () => <>{" "}</>;
107108function Nav() {
109return (
110<>
126}
127128function Header({ cycleColor }: {
129cycleColor: () => void;
130}) {
154}
155156function Footer(props) {
157return (
158<footer className="container mb2 mt2">
184}
185186function Home(props) {
187return (
188<div className="container space-children">
231}
232233function Unknown(props) {
234return (
235<div className="container">
239}
240241function NovanticaPromoHero() {
242return (
243<section className="promo">
255}
256257function NovanticaPromoFooter() {
258return (
259<section className="promo mt2 mb2">
279const timestamp = (date: Date | string) => new Date(date).toLocaleDateString("en-US", { timeZone: "UTC" });
280281function PostHeader({ post, primary }: { post: PostData; primary?: boolean }) {
282const Element = primary ? "h1" : "h3";
283return (
297}
298299function PostList({ posts }) {
300return (
301<>
320}
321322function RecentPosts({ data }) {
323const recent = (data?.posts || [])
324.filter(p => !p.draft)
337}
338339function Blog({ data }) {
340const posts = data.posts.filter(p => !p.draft);
341return (
354}
355356function Post({ data }) {
357const { post } = data;
358return (
381};
382383export const routes: Record<Route, React.FunctionComponent> = {
384[Route.Home]: Home,
385[Route.Blog]: Blog,
388};
389390export function setCookie(key: string, value: string) {
391fetch("/", {
392method: "POST",
395}
396397function parseCookies(cookies: string) {
398return (cookies || "").split(";").reduce((acc, n) => {
399const [key, value] = n.split("=").map(s => s.trim());
vtClaudemain.http.tsx1 match
359);
360361export default async function(req: Request): Promise<Response> {
362const url = new URL(req.url);
363const path = url.pathname;