diff --git a/index.ts b/index.ts index fab135a..fcbc8d4 100644 --- a/index.ts +++ b/index.ts @@ -6,7 +6,7 @@ const server = Bun.serve({ port: PORT, async fetch(req) { if (!req.body) { - throw new Error("woops!"); + throw new Error("No body provided"); } const submittedData = await req.json(); @@ -25,6 +25,13 @@ ${JSON.stringify(submittedData, null, 2)} } }); }, + error(error) { + return new Response(`
${error}\n${error.stack}
`, { + headers: { + "Content-Type": "text/html", + }, + }); + }, }); console.log(`Listening on http://localhost:${server.port}...`);