The simple API example for bank account users.
http://ec2-52-14-199-14.us-east-2.compute.amazonaws.com/
- Path: /api/users
- Methods: PUT
- Allowed parameters:
{ email: String, firstName: String, lastName: String, password: String, confirmationPassword: String }
- Required parameters: All
- Authentication: Public
- Example:
$ curl -X PUT -H "Content-Type: application/json" -d '{"email":"[email protected]","firstName":"Jon","lastName":"Dough","password":"ColdPlay","confirmPassword":"ColdPlay"}' http://ec2-52-14-199-14.us-east-2.compute.amazonaws.com/api/users
- Response:
201 Created - JSON { userId: Integer, email: String, firstName: String, lastName: String, createdAt: Date, updatedAt: Date }
400 Bed Request - JSON { message: String, code: String, originalError: Array[{ message: String, code: String }] }
- Path: /api/users
- Methods: POST
- Allowed parameters:
{ email: String, firstName: String, lastName: String, password: String, confirmationPassword: String }
- Required parameters: No
- Authentication: Basic
- Example:
$ curl -X POST -H "Content-Type: application/json" -d '{"email":"[email protected]","firstName":"NewJon","lastName":"NewDough","password":"NewColdPlay","confirmPassword":"NewColdPlay"}' -u [email protected]:ColdPlay http://ec2-52-14-199-14.us-east-2.compute.amazonaws.com/api/users
- Response:
204 NO_CONTENT
400 Bed Request - JSON { message: String, code: String, originalError: Array[{ message: String, code: String }] }
401 Unauthorized - JSON { message: String, code: String }
403 Forbidden - JSON { message: String, code: String }
- Path: /api/users/balance
- Methods: GET
- Allowed parameters: Not allowed
- Required parameters: No
- Authentication: Basic
- Example:
$ curl -X GET -H "Content-Type: application/json" -u [email protected]:NewColdPlay http://ec2-52-14-199-14.us-east-2.compute.amazonaws.com/api/users/balance
- Response:
200 OK - JSON { balance: Integer }
400 Bed Request - JSON { message: String, code: String, originalError: Array[{ message: String, code: String }] }
401 Unauthorized - JSON { message: String, code: String }
403 Forbidden - JSON { message: String, code: String }
- Path: /api/transactions/
- Methods: PUT
- Allowed parameters:
{ merchantId: Integer, amountInCents: Integer }
- Required parameters: All
- Authentication: Basic
- Example:
$ curl -X PUT -H "Content-Type: application/json" -d '{"merchantId":1,"amountInCents":100}' -u [email protected]:NewColdPlay http://ec2-52-14-199-14.us-east-2.compute.amazonaws.com/api/transactions
- Response:
201 Created - JSON { status: Enum[ACCEPTED | REJECTED] }
400 Bed Request - JSON { message: String, code: String, originalError: Array[{ message: String, code: String }] }
401 Unauthorized - JSON { message: String, code: String }
403 Forbidden - JSON { message: String, code: String }
To install dependencies you need to run a following command in shell
$ npm install
To run the unit tests you need to run a following command in shell
$ npm test
To run application you need to run a following command in shell
$ npm start
Also there is an option to run docker env. First create .env file in root directory then run a following command in shell
$ npm run launch
OR
$ docker-compose up --build --force-recreate -d