Skip to content

Latest commit

 

History

History
80 lines (54 loc) · 2.29 KB

README.md

File metadata and controls

80 lines (54 loc) · 2.29 KB

gobank

A JSON API for a bank written in Go.

I tried to mostly use the Go standard library.

For a router, I use chi.

Authorization is accomplished using JWT.

Password hashing using bcrypt.

Database is PostgreSQL.

Connects with the database using pq.

The project is set up to run several docker containers using docker-compose.

I also learned how to use make to automate the build process.

About

This project stems from a video I found from Anthony GG.

I also referenced this video to learn more about using docker-compose.

My main goal with this project is the build a basic JSON API with Go to understand how developing web backends in Go works and the idioms Go developers use.

On the to do list:

  • Transfer endpoint
    • Implement storage method for transfer
    • Implement add balance method
    • Implement subtract balance method
    • Implement seeding method for balance
    • Implement transfer endpoint
  • Error handling enhancements
  • Add ability for admins to update accounts
  • Investigate adding chi middleware
  • Investigate adding logging
  • Write docs for endpoints
    • Open API library
  • Clean up comments Future Tasks
  • Transaction history table
  • Testing (unit, integration, end-to-end)
  • Create a client UI using Go html templates or HTMX

Usage

Use the template env file to pass in all the required fields for your database

To run the server, run the following command:

make run

This calls the docker compose command to compile the Go code, run the server and the database.

To stop the server, run the following command:

make stop

View the logs of the server, run the following command:

docker compose logs 
# or 
docker compose logs -f 
# to follow the logs (attach terminal to logs)

If you want to completely remove the project including the gobank image, containers, and volumes, run the following command:

make stop clean=true