A sample of Go language web server - Weblog
The blog is operable with various internal packages. This packages are separated pieces of logic to increase readability and maintainability.
Core packages consists of main functionalities such as database connection, migrations and static settings.
It's the package that responsible for adding the routes to web server and applying the middlewares to requests and responses.
This package contains all the models in application that will map to a table in database using Gorm.
In all the application, only this package allowed to communicate directly with database. It's a business logic layer.
This package is responsible to receiving requests, process them and generate corresponding response.
Middleware package contains all of required middleware for web server to apply on requests and responses.
It's that package that responsible to containing blind and independent concurrent pipelines for various of tasks (Concurrent pipeline design pattern)
For more readability and increase control of user inputs, all user inputs that aren't based on a model, will handle with a serializer.
Utils package contains general functionalities in application.
Containing unit tests