diff options
Diffstat (limited to 'src/worker.ts')
| -rw-r--r-- | src/worker.ts | 8 |
1 files changed, 4 insertions, 4 deletions
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<Env> { const currentValue = (await this.ctx.storage.get<number>('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<Env> { if (pathname === '/get') { const currentValue = (await this.ctx.storage.get<number>('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<Env> { 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() |
