A lightweight banking API built with Go that provides basic banking operations through RESTful endpoints.
- Account management (Create, Read, Delete operations)
- JSON-based API responses
- Error handling middleware
- Gorilla Mux router for efficient routing
gobank/
├── api.go # API handlers and server implementation
├── types.go # Data structures and types
├── main.go # Application entry point
├── go.mod # Go module file
├── go.sum # Go module checksum
└── Makefile # Build automation
Retrieves account information.
Response:
{
"id": integer,
"firstName": string,
"lastName": string,
"number": integer,
"balance": integer
}Creates a new account.
Deletes an existing account.
- Go 1.x or higher
- Make (optional, for using Makefile commands)
- Clone the repository:
git clone github.com/tobiadiks/gobank
cd gobank- Install dependencies:
go mod download- Run the server:
go run .The server will start on the configured port (check main.go for the port configuration).
The project uses the following Go packages:
github.com/gorilla/muxfor routing- Standard Go libraries for JSON handling and HTTP server
The API includes a custom error handling middleware that returns errors in the following format:
{
"error": "error message"
}Feel free to submit issues and enhancement requests.