- Routing framework: ozzo-routing
- Database: ozzo-dbx
- Data validation: ozzo-validation
- Logging: logrus
- Configuration: viper
- Dependency management: dep
- Testing: testify
Run ./start.sh or manually enter the docker compose commands to bring up local server and postgresql db instance.
$ docker-compose build
$ docker-compose down
$ docker-compose up -d
$ docker-compose exec go-blog psql -U admin -d go_blog -a -f /docker-entrypoint-initdb.d/db.sql
The application runs as an HTTP server at port 8080. It provides the following RESTful endpoints:
GET /ping: a ping service mainly provided for health check purposeGET /v1/articles: returns a paginated list of the articleGET /v1/articles/:id: returns the detailed information of an articlePOST /v1/articles: creates a new articlePUT /v1/articles/:id: updates an existing articleDELETE /v1/articles/:id: deletes an articlePOST /v1/auth: authenticate a user
models: contains the data structures used for communication between different layers.services: contains the main business logic of the application.daos: contains the DAO (Data Access Object) layer that interacts with persistent storage.apis: contains the API layer that wires up the HTTP routes with the corresponding service APIs.
The rest of the packages are used globally:
app: contains routing middlewares and application-level configurationserrors: contains error representation and handlingutil: contains utility code