hello-dagger/main.go

29 lines
517 B
Go
Raw Normal View History

2024-10-11 10:20:07 +00:00
package main
import (
"fmt"
"net/http"
log "github.com/sirupsen/logrus"
2024-10-11 10:20:07 +00:00
)
func main() {
http.HandleFunc("/", helloWorldHandler)
port := 9000
log.Info("Starting on port ", port)
err := http.ListenAndServe(fmt.Sprint(":", port), nil)
if err != nil {
log.Error("Something bad happened")
}
2024-10-11 10:20:07 +00:00
}
func helloWorldHandler(w http.ResponseWriter, r *http.Request) {
log.Info("Request from", r.RemoteAddr)
_, err := w.Write([]byte("Hello World"))
if err != nil {
log.Error("Unable to write hello world")
}
2024-10-11 10:20:07 +00:00
}