From 3299f44b1730a05db7bed0fef2baafa39032bf54 Mon Sep 17 00:00:00 2001 From: Yuval Adam <_@yuv.al> Date: Thu, 10 Jul 2025 13:43:26 +0200 Subject: Fix locals ref --- src/worker.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/worker.ts') diff --git a/src/worker.ts b/src/worker.ts index 0ad83a6..5eb9d5d 100644 --- a/src/worker.ts +++ b/src/worker.ts @@ -20,8 +20,8 @@ class CounterDurableObject extends DurableObject { const currentValue = (await this.ctx.storage.get('counter')) || 0; const newValue = currentValue + 1; await this.ctx.storage.put('counter', newValue); - - return new Response(JSON.stringify({ + + return new Response(JSON.stringify({ counter: newValue, timestamp: new Date().toISOString() }), { @@ -31,7 +31,7 @@ class CounterDurableObject extends DurableObject { if (pathname === '/get') { const currentValue = (await this.ctx.storage.get('counter')) || 0; - return new Response(JSON.stringify({ + return new Response(JSON.stringify({ counter: currentValue, timestamp: new Date().toISOString() }), { @@ -41,7 +41,7 @@ class CounterDurableObject extends DurableObject { if (pathname === '/reset') { await this.ctx.storage.put('counter', 0); - return new Response(JSON.stringify({ + return new Response(JSON.stringify({ counter: 0, message: 'Counter reset', timestamp: new Date().toISOString() -- cgit v1.3.1