REST API for money transfer without Spring!
Libraries:
- Jetty as an embedded web server
- Guice as a DI tool
- Jackson for JSON serialization/deserializtion.
Request:
POST localhost:8080/account
{
"name": "user1",
"balance": 100
}
Response on success: 201 Created
{
"name": "user1",
"balance": 100.0,
"id": 1
}
Response if input JSON is invalid: 400 Bad request
Request: GET localhost:8080/account/{id}
Response on success: 200 OK
{
"name": "user1",
"balance": 100,
"id": 1
}
Response if id could not be parsed: 400 Bad Request
Response if there was server error: 500 Internal Server Error
Request:
POST localhost:8080/transaction
{
"from": 1,
"to": 2,
"amount": 25
}
Response on success: 200 OK
Response if transaction JSON could not be parsed: 400 Bad Request
Response if transaction processing failed (no account, no money, transfer to the same account): 406 Not Acceptable
This project is MIT licensed.