From 35ca4d49cc69c1fc63b60cfd0b2138e21b0d1fcf Mon Sep 17 00:00:00 2001 From: maotovisk Date: Sat, 21 Feb 2026 20:16:28 -0300 Subject: [PATCH] feat: add basic http server with hello world --- cmd/dropr-server/main.go | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 cmd/dropr-server/main.go diff --git a/cmd/dropr-server/main.go b/cmd/dropr-server/main.go new file mode 100644 index 0000000..d024ada --- /dev/null +++ b/cmd/dropr-server/main.go @@ -0,0 +1,28 @@ +package main + +import ( + "fmt" + "net/http" +) + +func main() { + const PORT = ":8080" + + http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(http.StatusOK) + w.Header().Set("Content-Type", "text/plain") + + _, err := fmt.Fprintf(w, "Hello, World!") + if err != nil { + http.Error(w, "Internal Server Error", http.StatusInternalServerError) + return + } + }) + + fmt.Println("Listening on port " + PORT) + err := http.ListenAndServe(PORT, nil) + + if err != nil { + panic(err) + } +}