import { Hono } from 'hono'
const app = new Hono()
async function stall(stallTime = 3000) {
await new Promise(resolve => setTimeout(resolve, stallTime));
}
app.get('/hello', async (c) => {
// Should show up when hitting Cancel in Postman
c.req.raw.signal.addEventListener("abort", () => {
console.log("Aborted");
})
// Simulate a long-running task
await stall(10000);
return c.text("Hello from Hono!");
})
Deno.serve(app.fetch)
import { Hono } from 'hono'
const app = new Hono()
async function stall(stallTime = 3000) {
await new Promise(resolve => setTimeout(resolve, stallTime));
}
app.get('/hello', async (c) => {
// Should show up when hitting Cancel in Postman
c.req.raw.signal.addEventListener("abort", () => {
console.log("Aborted");
})
// Simulate a long-running task
await stall(10000);
return c.text("Hello from Hono!");
})
Deno.serve(app.fetch)