minior changes

main
parent ed3d67a14a
commit 0884866c90

@ -2,9 +2,8 @@ FROM golang:1.21.1
WORKDIR /app WORKDIR /app
COPY go.mod ./ COPY go.mod go.sum ./
RUN go mod download RUN go mod download && go mod verify
RUN go mod verify
COPY . . COPY . .
RUN go build -v -o ./bin/server . RUN go build -v -o ./bin/server .

@ -1,9 +1,9 @@
version: '3'
services: services:
app: app:
build: build:
context: . context: .
dockerfile: Dockerfile dockerfile: Dockerfile
ports: ports:
# generated with "hash2addr lab.phc.dm.unipi.it/portainer-example"
- "127.14.115.95:1091:4000" - "127.14.115.95:1091:4000"
restart: unless-stopped restart: unless-stopped

@ -1,3 +1,5 @@
module git.phc.dm.unipi.it/phc/portainer-example module git.phc.dm.unipi.it/phc/portainer-example
go 1.21.1 go 1.21.1
require github.com/alecthomas/repr v0.2.0 // indirect

@ -0,0 +1,2 @@
github.com/alecthomas/repr v0.2.0 h1:HAzS41CIzNW5syS8Mf9UwXhNH1J9aix/BvDRf1Ml2Yk=
github.com/alecthomas/repr v0.2.0/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4=

@ -3,7 +3,6 @@ package main
import ( import (
"encoding/json" "encoding/json"
"log" "log"
"mime"
"net/http" "net/http"
) )
@ -15,8 +14,11 @@ func main() {
return return
} }
w.Header().Set("Content-Type", mime.TypeByExtension(".json")) w.Header().Set("Content-Type", "application/json")
if err := json.NewEncoder(w).Encode("ok"); err != nil { if err := json.NewEncoder(w).Encode(map[string]any{
"question": "Whats the answer to life the universe and everything?",
"answer": 42,
}); err != nil {
log.Fatal(err) log.Fatal(err)
return return
} }

Loading…
Cancel
Save