181
182 try {
183 const response = await fetch("/", {
184 method: "POST",
185 body: JSON.stringify({
5async function servePublicFile(path: string): Promise<Response> {
6 const url = new URL("./public/" + path, import.meta.url);
7 const text = await (await fetch(url, {
8 headers: {
9 "User-Agent": "", // to transpile TS to JS
15 const start = performance.now();
16 try {
17 res = await fetch(url);
18 end = performance.now();
19 status = res.status;
25 } catch (e) {
26 end = performance.now();
27 reason = `couldn't fetch: ${e}`;
28 ok = false;
29 }
6app.get('', async (c) => c.text(await parseRecipe('https://www.thespruceeats.com/potato-and-green-bean-salad-3059769')));
7
8export default app.fetch;
5async function servePublicFile(path: string): Promise<Response> {
6 const url = new URL("./public/" + path, import.meta.url);
7 const text = await (await fetch(url, {
8 headers: {
9 "User-Agent": "", // to transpile TS to JS
181
182 try {
183 const response = await fetch("/", {
184 method: "POST",
185 body: JSON.stringify({
52});
53
54export default app.fetch.bind(app);
7
8 if (url.pathname === "/worker.ts") {
9 const js = await (await fetch("https://esm.town/v/maxm/codemirrorTs/worker")).text();
10 return new Response(js, {
11 headers: {
43console.log("loading sdk")
44const vt = new ValTown();
45console.log("Fetching me")
46const me = await vt.me.profile.retrieve();
47console.log(me)
5async function servePublicFile(path: string): Promise<Response> {
6 const url = new URL("./public/" + path, import.meta.url);
7 const text = await (await fetch(url, {
8 headers: {
9 "User-Agent": "", // to transpile TS to JS
181
182 try {
183 const response = await fetch("/", {
184 method: "POST",
185 body: JSON.stringify({