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) + } +}