add transfer route

This commit is contained in:
2025-07-08 03:20:50 +08:00
parent 11b57ce46a
commit 6deae3fcdb

View File

@ -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({