Versions
- Open: VersionChanges from v92 to v93+0-0⦚ 22 unchanged lines ⦚⦚ 22 unchanged lines ⦚
- Open: VersionChanges from v91 to v92+2-8⦚ 11 unchanged lines ⦚}
async function getTodos() {let { columns, rows } = await sqlite.execute(`select * from todos`);return rows.map(row => Object.fromEntries(zip(columns, row)));}export let todo_list = async (req: Request): Promise<Response> => {let url = new URL(req.url);if (url.pathname === "/todos" && req.method === "POST") {await addTodo(req);return Response.json(await getTodos()); // probably only need to return OK}let initialTodos = await getTodos();return ssr_hydrate("stevekrouse", "TodoApp", { initialTodos, initialTime: Date.now() });};⦚ 11 unchanged lines ⦚}export let todo_list = async (req: Request): Promise<Response> => {let url = new URL(req.url);if (url.pathname === "/todos" && req.method === "POST") {await addTodo(req);return Response.json("OK");}return ssr_hydrate("stevekrouse", "TodoApp")(req);}; - Open: VersionChanges from v90 to v91+1-1⦚ 20 unchanged lines ⦚if (url.pathname === "/todos" && req.method === "POST") {await addTodo(req);
return Response.json(await getTodos());}⦚ 3 unchanged lines ⦚⦚ 20 unchanged lines ⦚if (url.pathname === "/todos" && req.method === "POST") {await addTodo(req);return Response.json(await getTodos()); // probably only need to return OK}⦚ 3 unchanged lines ⦚ - Open: VersionChanges from v89 to v90+1-1⦚ 24 unchanged lines ⦚let initialTodos = await getTodos();
return ssr_hydrate("stevekrouse", "TodoApp", { initialTodos, initialTime: new Date() });};⦚ 24 unchanged lines ⦚let initialTodos = await getTodos();return ssr_hydrate("stevekrouse", "TodoApp", { initialTodos, initialTime: Date.now() });}; - Open: VersionChanges from v88 to v89+3-19/** @jsxImportSource https://esm.sh/react */
import { renderToString } from "https://esm.sh/react-dom@18.2.0/server";import { sqlite } from "https://esm.town/v/std/sqlite?v=4";import { html } from "https://esm.town/v/stevekrouse/html";import todo_setup_table from "https://esm.town/v/stevekrouse/todo_setup_table";import { TodoApp } from "https://esm.town/v/stevekrouse/TodoApp";import { zip } from "npm:lodash-es";⦚ 12 unchanged lines ⦚export let todo_list = async (req: Request): Promise<Response> => {let url = new URL(req.url);if (url.pathname === "/todos" && req.method === "GET")return Response.json(await getTodos());if (url.pathname === "/todos" && req.method === "POST") {await addTodo(req);return Response.json(await getTodos());}let intiialTodos = await getTodos();return html(renderToString(<html><head><title>Todo List</title><script type="module" src="https://esm.town/v/stevekrouse/todoListScript" /></head><body><div id="app"><TodoApp initialTodos={intiialTodos, initialTime: new Date()} /></div></body></html>,));};/** @jsxImportSource https://esm.sh/react */import { sqlite } from "https://esm.town/v/std/sqlite?v=4";import ssr_hydrate from "https://esm.town/v/stevekrouse/ssr_hydrate_react";import todo_setup_table from "https://esm.town/v/stevekrouse/todo_setup_table";import { zip } from "npm:lodash-es";⦚ 12 unchanged lines ⦚export let todo_list = async (req: Request): Promise<Response> => {let url = new URL(req.url);if (url.pathname === "/todos" && req.method === "POST") {await addTodo(req);return Response.json(await getTodos());}let initialTodos = await getTodos();return ssr_hydrate("stevekrouse", "TodoApp", { initialTodos, initialTime: new Date() });}; - Open: VersionChanges from v87 to v88+19-3/** @jsxImportSource https://esm.sh/react */
import { sqlite } from "https://esm.town/v/std/sqlite?v=4";import ssr_hydrate from "https://esm.town/v/stevekrouse/ssr_hydrate_react";import todo_setup_table from "https://esm.town/v/stevekrouse/todo_setup_table";import { zip } from "npm:lodash-es";⦚ 12 unchanged lines ⦚export let todo_list = async (req: Request): Promise<Response> => {let url = new URL(req.url);if (url.pathname === "/todos" && req.method === "POST") {await addTodo(req);return Response.json(await getTodos());}let initialTodos = await getTodos();return ssr_hydrate("stevekrouse", "TodoApp", { initialTodos });};/** @jsxImportSource https://esm.sh/react */import { renderToString } from "https://esm.sh/react-dom@18.2.0/server";import { sqlite } from "https://esm.town/v/std/sqlite?v=4";import { html } from "https://esm.town/v/stevekrouse/html";import todo_setup_table from "https://esm.town/v/stevekrouse/todo_setup_table";import { TodoApp } from "https://esm.town/v/stevekrouse/TodoApp";import { zip } from "npm:lodash-es";⦚ 12 unchanged lines ⦚export let todo_list = async (req: Request): Promise<Response> => {let url = new URL(req.url);if (url.pathname === "/todos" && req.method === "GET")return Response.json(await getTodos());if (url.pathname === "/todos" && req.method === "POST") {await addTodo(req);return Response.json(await getTodos());}let intiialTodos = await getTodos();return html(renderToString(<html><head><title>Todo List</title><script type="module" src="https://esm.town/v/stevekrouse/todoListScript" /></head><body><div id="app"><TodoApp initialTodos={intiialTodos, initialTime: new Date()} /></div></body></html>,));}; - Open: VersionChanges from v86 to v87+0-0⦚ 28 unchanged lines ⦚⦚ 28 unchanged lines ⦚
- Open: VersionChanges from v85 to v86+0-2⦚ 18 unchanged lines ⦚export let todo_list = async (req: Request): Promise<Response> => {let url = new URL(req.url);
if (url.pathname === "/todos" && req.method === "GET")return Response.json(await getTodos());if (url.pathname === "/todos" && req.method === "POST") {await addTodo(req);return Response.json(await getTodos());⦚ 5 unchanged lines ⦚⦚ 18 unchanged lines ⦚export let todo_list = async (req: Request): Promise<Response> => {let url = new URL(req.url);if (url.pathname === "/todos" && req.method === "POST") {await addTodo(req);return Response.json(await getTodos());⦚ 5 unchanged lines ⦚ - Open: Version+30-0/** @jsxImportSource https://esm.sh/react */import { sqlite } from "https://esm.town/v/std/sqlite?v=4";import ssr_hydrate from "https://esm.town/v/stevekrouse/ssr_hydrate_react";import todo_setup_table from "https://esm.town/v/stevekrouse/todo_setup_table";import { zip } from "npm:lodash-es";todo_setup_table();async function addTodo(req: Request) {const name = await req.json();await sqlite.execute({ sql: `insert into todos(text) values (?)`, args: [name] });}async function getTodos() {let { columns, rows } = await sqlite.execute(`select * from todos`);return rows.map(row => Object.fromEntries(zip(columns, row)));}export let todo_list = async (req: Request): Promise<Response> => {let url = new URL(req.url);if (url.pathname === "/todos" && req.method === "GET")return Response.json(await getTodos());if (url.pathname === "/todos" && req.method === "POST") {await addTodo(req);return Response.json(await getTodos());}let initialTodos = await getTodos();return ssr_hydrate("stevekrouse", "TodoApp", { initialTodos });};
stevekrouse-todo_list.web.val.run
Updated: February 22, 2024