Golang Project Hexagonal Architecture
A simple golang project structure for creating API
The project structure follow Hexagonal architecture from GopherCon 2018.
This project structure only caters to the simplest project.
You can add the folder/package that needed.
Add the http handler to invoke the function using http or command.
All the configuration files will be put here.
All the code that private and not for shared.
All the code that can be accessed by other.
Use Case: CRUD API for Creator
struct for adding creator and service to call the add to repository
handler for http request
package mongodb for storage data in mongodb
package mongodb for storage data in json
In this case, there are 2 types of storage to cater to different use cases, if your project store the data using SQL, NoSQL, or write to a file. No matter the storage type, the changes should be minor.
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.