Golang http server with logging and gracefull shutdown
- 'root' folder with mux and gracefull shutdown
- 'basic' subfolder without mux and gracefull shutdown
- go get -d -v
- go clean
- go build
- go run ip.go
- go get -u github.com/go-delve/delve/cmd/dlv
- dlv debug ./ip
- GOOS=linux GOARCH=386 go build (386 needed for busybox)
- GOOS=linux GOARCH=arm GOARM=6 go build (Raspberry Pi build)
- GOOS=linux GOARCH=arm64 go build (Odroid C2 build)
- CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -v .
docker build -t gosimplehttpserver:latest . --build-arg BIN_FILE=./gosimplehttpserver
- docker tag gosimplehttpserver:latest docker.pkg.github.com/wlanboy/gosimplehttpserver/gosimplehttpserver:latest
- docker push docker.pkg.github.com/wlanboy/gosimplehttpserver/gosimplehttpserver:latest
docker run --name gosimplehttpserver -p 7000:7000 wlanboy/gosimplehttpserver
- curl http://127.0.0.1:7000/ip
- curl http://127.0.0.1:7000/host
- curl http://127.0.0.1:7000/agent
- curl -H "hello: world" http://127.0.0.1:7000/header
- curl http://127.0.0.1:7000/dump to get the dump of the whole http request object
- http://127.0.0.1:7000/ to get pastebin homepage
- curl -X POST -F 'code=myprettylittleinformation' http://127.0.0.1:7000/paste to create a paste