A simple Rust API server using Axum with sqlite as database
cargo runThe server will start on http://localhost:8080.
http://localhost:8080/v1/finance
- Description: Retrieve finance data.
- Response:
200 OK– Returns a JSON array of finance records.
{
"message": "Success",
"data": [
{
"id": 1,
"reason": "salary",
"variant": "in",
"amount": 10000,
"created_at": "2025-05-30 08:59:34"
},
{
"id": 2,
"reason": "buy thing",
"variant": "out",
"amount": 1000,
"created_at": "2025-05-30 09:02:50"
},
{
"id": 3,
"reason": "buy thing again",
"variant": "out",
"amount": 10000,
"created_at": "2025-05-30 09:04:56"
}
]
}- Description: Create a new finance record.
- Request Body:
interface Body { variant: "in" | "out"; reason: string; amount: number; }
- Response:
201 Created– Returns the created record.
- Description: Retrieve a specific finance record by ID.
- Response:
200 OK– Returns the finance record.
{
"message": "Success",
"data": {
"id": 1,
"reason": "salary",
"variant": "in",
"amount": 10000,
"created_at": "2025-05-30 08:59:34"
}
}