update question
This commit is contained in:
@ -11,8 +11,8 @@ class Transfer(BaseModel):
|
|||||||
app = FastAPI()
|
app = FastAPI()
|
||||||
|
|
||||||
accounts = {
|
accounts = {
|
||||||
'1': 1000,
|
'1': {'amount': 1000},
|
||||||
'2': 1000,
|
'2': {'amount': 1000},
|
||||||
}
|
}
|
||||||
|
|
||||||
transactions: list[Transfer] = []
|
transactions: list[Transfer] = []
|
||||||
|
|||||||
@ -13,9 +13,13 @@ type Transfer struct {
|
|||||||
Receiver int `json:"receiver"`
|
Receiver int `json:"receiver"`
|
||||||
}
|
}
|
||||||
|
|
||||||
var accounts = map[int]int{
|
type Account struct {
|
||||||
1: 1000,
|
Amount int `json:"amount"`
|
||||||
2: 1000,
|
}
|
||||||
|
|
||||||
|
var accounts = map[int]Account{
|
||||||
|
1: {Amount: 1000},
|
||||||
|
2: {Amount: 1000},
|
||||||
}
|
}
|
||||||
|
|
||||||
var transactions = []Transfer{}
|
var transactions = []Transfer{}
|
||||||
|
|||||||
@ -31,6 +31,6 @@ app.post('/transfer', async (c) => {
|
|||||||
serve({
|
serve({
|
||||||
fetch: app.fetch,
|
fetch: app.fetch,
|
||||||
port: 3000
|
port: 3000
|
||||||
}, (info) => {
|
}, (server) => {
|
||||||
console.log(`Server is running on http://localhost:${info.port}`)
|
console.log(`Server is running on http://localhost:${server.port}`)
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user