Skip to content

Latest commit

 

History

History
62 lines (51 loc) · 1.1 KB

README.md

File metadata and controls

62 lines (51 loc) · 1.1 KB

Money Transfer

REST API for money transfer without Spring!

Libraries:

  • Jetty as an embedded web server
  • Guice as a DI tool
  • Jackson for JSON serialization/deserializtion.

Create account

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

Get account info

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

Make transaction

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.