- Should be rewritten for using of JAXRS
- Replace Hand-written in-memory data storage with H2 or Embedded PostgreSQL
- Add Swagger for API documentation
Design and implement a RESTful API (including data model and the backing implementation) for money transfers between accounts.
- You can use Java, Scala or Kotlin.
- Keep it simple and to the point (e.g. no need to implement any authentication).
- Assume the API is invoked by multiple systems and services on behalf of end users.
- You can use frameworks/libraries if you like (except Spring), but don't forget about requirement #2 – keep it simple and avoid heavy frameworks.
- The datastore should run in-memory for the sake of this test.
- The final result should be executable as a standalone program (should not require a pre-installed container/server).
- Demonstrate with tests that the API works as expected.
- Java 11
- Maven
- Spark Framework (with embedded Jetty)
- Logback
- Lombok
- google/gson
- Hand-written in-memory data storage using concurrency utilities
- JUnit 5
- Apache HttpClient (for unit testing)
java -jar "./rest-api-app/target/rest-api-app-1.3.0.jar"
- GET http://localhost:9999/parties?limit=10
- GET http://localhost:9999/parties/1
- GET http://localhost:9999/parties/1/accounts
- GET http://localhost:9999/accounts?limit=10
- GET http://localhost:9999/accounts/1
- GET http://localhost:9999/accounts/1/transactions?limit=100
- GET http://localhost:9999/transactions?limit=100
- GET http://localhost:9999/transactions/1
- POST http://localhost:9999/transactions
- http://localhost:9999/parties?limit=10
- http://localhost:9999/parties?page=2&limit=20
- http://localhost:9999/accounts/1/transactions?limit=100
- 200 OK
- 400 Bad request
- 404 Not found
- Using Russian bank accounts
- Decided to ignore topics of currency conversions and multi-currency operations