minior changes

main
Antonio De Lucreziis 6 months ago
parent ed3d67a14a
commit 0884866c90

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

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

@ -1,3 +1,5 @@
module git.phc.dm.unipi.it/phc/portainer-example
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 (
"encoding/json"
"log"
"mime"
"net/http"
)
@ -15,8 +14,11 @@ func main() {
return
}
w.Header().Set("Content-Type", mime.TypeByExtension(".json"))
if err := json.NewEncoder(w).Encode("ok"); err != nil {
w.Header().Set("Content-Type", "application/json")
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)
return
}

Loading…
Cancel
Save