- Your are required to use
TypeScript
for the task and build the APIs (endpoints) withexpress
- Use and setup the project with
Yarn
- Install docker on your Mac Download
- Create a docker Registry on Create Account
- Containerize your application with Docker.
Imagine you are asked to develop a transfer service with APIs to transfer money between two accounts You application is expected to have the following database structure
-
TABLE 1 - transactions
- reference (unique)
- senderAccount nr
- amount
- receiverAccount nr
- transferDescription
- createdAt
-
TABLE 2 - balances
- account nr (unique)
- balance
- createdAt
The transaction table registers any transaction in an account (ie. today I paid N2000 for a movie with my card), the balances table represents the account balance of customers (ie. I have N50k in my bank account). If a sender is trying to make a transaction of an amount of money more than his current balance, an error should be returned indicating insufficient funds
The API you are to develop should be able to handle a transfer request of the form below and updates the transactions/balances table accordingly.
{
from: account,
to: account,
amount: money
}
Method | Endpoint | Enable a user to: |
---|---|---|
POST | /create-account | Enable user to create an account stored in the balance table |
GET | /balance/:accountNumber | Getting balance for a particular account number |
GET | /balance | Getting all accounts and their balance |
POST | /transfer | To make a transaction to another account |
- Make sure you write test to cover your application using supertest
- Host your application on Heroku