diff --git a/hono/src/index.ts b/hono/src/index.ts index bc1cc19..48d79c0 100644 --- a/hono/src/index.ts +++ b/hono/src/index.ts @@ -3,8 +3,23 @@ import { Hono } from 'hono' const app = new Hono() -app.get('/', (c) => { - return c.text('Hello Hono!') +app.post('/transfer', async (c) => { + const body = await c.req.json(); + const { amount, from, to } = body; + + if (amount <= 0) { + return c.json({ error: 'Amount must be greater than 0' }, 400); + } + + const transfer = { + amount, + from, + to + } + + console.log(transfer); + + return c.json(transfer) }) serve({