bank-simulator-backend

command module
v0.0.0-...-8f0e907 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 4, 2024 License: MIT Imports: 6 Imported by: 0

README

bank-simulator-backend

codecov Go Report Card Go Reference Build Status

BS-Backend.png

This project aimed to build the backend of a bank simulator system. The system features include:

  • General user/account's CUDR.
  • Retrieve the bank account info owned by users.
  • Making transactions between two accounts.
  • Retrieve transactions records from user and its accounts.

Table of Contents

1. Installation

Get latest production code:

git clone https://github.com/Petatron/bank-simulator-backend.git

Install three basic required environment:

It is recommand to use Homebrew to manage and install if you are using Linux or try to use them on terminal. (Please make sure you have installed Homebrew before run below commands.)

brew install go
brew install docker
2. Usage
Project Setup

The project used MakeFile to set up docker image and migrate database to docker container. After the environment tools installed Run the following commands to set up the project:

# Pull docker image and start docker container.
make postgres
# Create database and set up username and password.
make createdb
# Create tables
make migrateup

To start the server, run the following command:

go run main.go
API Endpoints

The project provides the following API endpoints:

  • GET /users: Retrieve all users.
  • GET /users/{id}: Retrieve a user by its id.
  • POST /users: Create a new user.
  • PUT /users/{id}: Update a user by its id.
  • DELETE /users/{id}: Delete a user by its id.
  • GET /users/{id}/accounts: Retrieve all accounts owned by a user.

In Postmanor any other API testing tool, you can use the following API endpoints to interact with the system:

  • Create a new user: POST http://localhost:8080/users
{
    "username": "",
    "full_name": "",
    "email": "",
    "password": ""
}
  • User login: POST http://localhost:8080/users/login
{
    "username": "",
    "password": ""
}

Version 1.1.3

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
db
mock
Package mockdb is a generated GoMock package.
Package mockdb is a generated GoMock package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL