hexagonal saga demo app
- Docker
- Go 1.22+
- MySQL 8.x
- Wire (for DI)
- Goose (for schema migration)
- Ginkgo, Gomega and GoMock for testing
- swaggo/swag
- Taskfile
$ docker-compose --profile backend up -d
$ cp env/local.env .env
$ docker-compose up migrate
$ docker-compose up dev
$ docker-compose up swagger
open swagger on the browser
$ open http://localhost:8090/swagger/index.html
$ http --json -v post localhost:8090/v1/trips/ < payload/create-trip.json
POST /v1/trips/ HTTP/1.1
Accept: application/json, */*;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 76
Content-Type: application/json
Host: localhost:8090
User-Agent: HTTPie/3.2.2
{
"carId": 1,
"flightId": 1,
"hotelId": 1,
"id": 1,
"userId": 1
}
HTTP/1.1 200 OK
Content-Length: 229
Content-Type: application/json; charset=utf-8
Date: Sat, 09 Sep 2023 09:17:13 GMT
{
"data": {
"carBookingId": 0,
"carId": 1,
"createdAt": "2023-09-09T09:17:13.87Z",
"flightBookingId": 0,
"flightId": 1,
"hotelBookingId": 0,
"hotelId": 1,
"id": 5,
"status": "Initialized",
"updatedAt": "0001-01-01T00:00:00Z",
"userId": 1
},
"status": true
}
$ http get localhost:8090/v1/trips/
HTTP/1.1 200 OK
Content-Length: 1044
Content-Type: application/json; charset=utf-8
Date: Sat, 09 Sep 2023 09:18:01 GMT
{
"data": [
{
"carBookingId": 2,
"carId": 1,
"createdAt": "2023-09-09T18:13:43+09:00",
"flightBookingId": 2,
"flightId": 1,
"hotelBookingId": 2,
"hotelId": 1,
"id": 2,
"status": "Booked",
"updatedAt": "0001-01-01T00:00:00Z",
"userId": 1
},
{
"carBookingId": 1,
"carId": 1,
"createdAt": "2023-09-09T18:13:36+09:00",
"flightBookingId": 1,
"flightId": 1,
"hotelBookingId": 1,
"hotelId": 1,
"id": 1,
"status": "Booked",
"updatedAt": "0001-01-01T00:00:00Z",
"userId": 1
}
],
"status": true
}