rename directories

This commit is contained in:
2025-07-14 17:02:31 +08:00
parent 742c8f5931
commit 0c8d6cbd06
21 changed files with 523 additions and 0 deletions

36
js-hono/src/index.ts Normal file
View File

@ -0,0 +1,36 @@
import { serve } from '@hono/node-server'
import { Hono } from 'hono'
const app = new Hono()
const accounts = {
'1': {amount: 1000},
'2': {amount: 1000},
}
const transactions = []
app.post('/transfer', async (c) => {
const body = await c.req.json();
const { amount, sender, receiver } = body;
if (amount <= 0) {
return c.json({ error: 'Amount must be greater than 0' }, 1000);
}
const transfer = {
amount,
sender,
receiver
}
console.log('transfer', transfe);
return c.json(transfer)
})
serve({
fetch: app.fetch,
port: 3000
}, (server) => {
console.log(`Server is running on http://localhost:${server.port}`)
})