first push - trying to get live debug going.
This commit is contained in:
parent
83e673b69f
commit
cb81c7fd63
21
.vscode/launch.json
vendored
Normal file
21
.vscode/launch.json
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Go Debug - Local",
|
||||
"type": "go",
|
||||
"request": "launch",
|
||||
"mode": "auto",
|
||||
"program": "${file}",
|
||||
"args": []
|
||||
},
|
||||
{
|
||||
"name": "Go Debug - Docker",
|
||||
"type": "go",
|
||||
"request": "attach",
|
||||
"mode": "remote",
|
||||
"port": 4000,
|
||||
"host": "127.0.0.1"
|
||||
}
|
||||
]
|
||||
}
|
9
Dockerfile
Normal file
9
Dockerfile
Normal file
@ -0,0 +1,9 @@
|
||||
FROM golang:alpine
|
||||
WORKDIR /app
|
||||
EXPOSE 80
|
||||
|
||||
COPY main.go ./
|
||||
ENV GO111MODULE=off
|
||||
RUN go build -o hello-app .
|
||||
|
||||
CMD [ "./hello-app" ]
|
11
Dockerfile.debug
Normal file
11
Dockerfile.debug
Normal file
@ -0,0 +1,11 @@
|
||||
FROM golang:alpine
|
||||
WORKDIR /app
|
||||
EXPOSE 80 4000
|
||||
|
||||
COPY ./main/* ./
|
||||
RUN CGO_ENABLED=0 go install -ldflags "-s -w -extldflags '-static'" github.com/go-delve/delve/cmd/dlv@latest
|
||||
RUN go install github.com/gorilla/mux
|
||||
ENV GO111MODULE=off
|
||||
RUN CGO_ENABLED=0 go build -gcflags "all=-N -l" -o debug-app .
|
||||
|
||||
CMD [ "/go/bin/dlv", "--listen=:4000", "--headless=true", "--log=true", "--accept-multiclient", "--api-version=2", "exec", "/app/debug-app" ]
|
5
main/go.mod
Normal file
5
main/go.mod
Normal file
@ -0,0 +1,5 @@
|
||||
module git.mpe.ca/eeckert/egnytewebhandler
|
||||
|
||||
go 1.21.4
|
||||
|
||||
require github.com/gorilla/mux v1.8.1 // indirect
|
2
main/go.sum
Normal file
2
main/go.sum
Normal file
@ -0,0 +1,2 @@
|
||||
github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY=
|
||||
github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ=
|
37
main/main.go
Normal file
37
main/main.go
Normal file
@ -0,0 +1,37 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
"net/http"
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
)
|
||||
|
||||
func readDataStream(resp http.ResponseWriter, request *http.Request) {
|
||||
reqBody, _ := io.ReadAll(request.Body)
|
||||
|
||||
// var jsonBody = json.NewDecoder(request.Body)
|
||||
fmt.Println(reqBody)
|
||||
}
|
||||
|
||||
func HealthCheck() {
|
||||
|
||||
}
|
||||
|
||||
func handleRequests() {
|
||||
// Start new Mux router
|
||||
mainrouter := mux.NewRouter().StrictSlash(true)
|
||||
|
||||
mainrouter.HandleFunc("/", readDataStream).Methods("POST")
|
||||
// mainrouter.HandleFunc("/healthcheck", HealthCheck).Methods("GET")
|
||||
|
||||
log.Fatal(http.ListenAndServe(":10000", mainrouter))
|
||||
|
||||
}
|
||||
|
||||
func main() {
|
||||
fmt.Println("MPE x Egnyte x PowerApps - Mux Router")
|
||||
handleRequests()
|
||||
}
|
Loading…
Reference in New Issue
Block a user