API for managing bank accounts. The API allows you to create, read, update and delete bank accounts.
The API was made with Go and was hosted on AWS EC2 as a container with Docker. For the database, we chose DynamoDB, which was hosted on AWS DynamoDB.
We used RabbitMQ for log management and Swagger for documentation.
Go to the db/
directory and create a .env
file. Add the following environment variables:
AWS_ACCESS_KEY_ID = <your_aws_access_key_id>
AWS_SECRET_ACCESS_KEY = <your_aws_secret_access_key>
REGION = <your_aws_region>
All these variables can be set to any value. They are only used to create the database locally.
Create a .env
file in the env/
directory and add the following environment variables:
AWS_ACCESS_KEY_ID = <your_aws_access_key_id>
AWS_SECRET_ACCESS_KEY = <your_aws_secret_access_key>
AWS_REGION = <your_aws_region>
GIN_MODE = release
JWT_SECRET = <your_jwt_secret>
AMQP_URL = <your_amqp_url>
EXCHANGE_QUEUE_NAME = <your_exchange_queue_name>
AWS_ACCESS_KEY_ID
, AWS_SECRET_ACCESS_KEY
and AWS_REGION
must the same as in the db/.env
file. AMQP_URL
and EXCHANGE_QUEUE_NAME
are optional. If you do not specify them, the logs will not be sent to the queue.
Firstly, you need to install Docker and Docker Compose.
Then run:
git clone
or download the repository.
Then run
cd db
docker-compose up
to start the database.
Then open another terminal and run
docker-compose up
in the root directory of the repository to start the API.
The API is documented with Swagger. You can access the documentation at http://localhost:8080/docs/index.html
.
The API is protected with JWT. To get the token, you need to generate it. You can do this online at jwt.io.
The token must contain the following payload:
{
"sub": "<your_id>",
"iat": "<current_timestamp>",
"exp": "<current_timestamp + desired_expiration_time>"
}
The JWT token must be sent in the Authorization
header in the following format:
Authorization <your_jwt_token>
For testing documentation, see https://github.com/david-slatinek/cr24-account-service/wiki.
David Slatinek |