The author discusses their API project built in Go, highlighting the organizational structure they implemented. The API, using the Fiber framework, manages book information with GET, PUT, and DELETE endpoints, storing data in Redis. The project's structure is detailed, explaining the purpose of each directory within the `pkg` folder. `main.go` initializes the application and calls the routes. The `pkg/configurations` holds database setup, specifically the Redis connection. `pkg/entities` defines the data structures used throughout the API. `pkg/repositories` contains functions to interact with the Redis database for CRUD operations. Routes are defined in `pkg/routes`, separated for better organization and readability. The `book_router.go` file configures the routes and calls corresponding handler functions. `pkg/handlers` contains the functions executed by the endpoints, such as the `SetBookHandler`. The author emphasizes the reasoning behind the structure, rather than just listing its components. The project uses Go modules (`go.mod`) for dependency management. The author hopes this structure is helpful for others starting with Go API development.
dev.to
dev.to
Create attached notes ...
