Skip to content

Commit 8ee1b0c

Browse files
committed
Fixes swagger and api/docs handler
1 parent 7d55a2c commit 8ee1b0c

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ RUN go mod download && \
99

1010
FROM gcr.io/distroless/static-debian12:nonroot
1111

12-
COPY --from=builder /app/bin/app /app
12+
COPY --from=builder /app/bin/app /app
13+
COPY --from=builder /app/resources/swagger.yaml ./resources/swagger.yaml

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@
33
build:
44
go build -o ./bin/app ./src/cmd/app/main.go
55

6-
run:test
6+
run-test:
77
ifeq ($(OS),Windows_NT)
88
$env:GO_ENV="test"; go run ./src/cmd/app/main.go
99
else
1010
GO_ENV=test go run ./src/cmd/app/main.go
1111
endif
1212

13-
run:prod:
13+
run-prod:
1414
ifeq ($(OS),Windows_NT)
1515
$env:GO_ENV="prod"; go run ./src/cmd/app/main.go
1616
else
17-
GO_ENV=prod go run ./src/cmd/app/main.go
17+
GO_ENV=prod go run ./src/cmd/app/main.go
1818
endif
1919

2020
test:

resources/swagger.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ components:
304304
AccountResponse:
305305
type: object
306306
properties:
307-
_id:
307+
ID:
308308
type: string
309309
format: uuid
310310
description: Account ID

src/controller/api.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package controller
22

33
import (
44
"net/http"
5+
"os"
56
"runtime"
67

78
"github.com/gorilla/mux"
@@ -63,6 +64,8 @@ func (controller *ApiController) CheckApiHandler(w http.ResponseWriter, r *http.
6364
}
6465

6566
func (controller *ApiController) ApiDocsHandler(w http.ResponseWriter, r *http.Request) {
67+
fileContent, _ := os.ReadFile("./resources/swagger.yaml")
68+
6669
w.WriteHeader(http.StatusOK)
67-
http.ServeFile(w, r, "resources/swagger.yaml")
70+
w.Write(fileContent)
6871
}

0 commit comments

Comments
 (0)