init
Some checks reported errors
continuous-integration/drone/push Build encountered an error

This commit is contained in:
aovantsev
2025-10-02 22:30:16 +03:00
parent fba4bb58f9
commit 0dcb5d9b87
7 changed files with 159 additions and 2 deletions

25
main.go Normal file
View File

@@ -0,0 +1,25 @@
package main
import (
"log"
"net/http"
)
func helloHandler(w http.ResponseWriter, r *http.Request) {
if r.Method != http.MethodGet {
http.Error(w, "Method not allowed", http.StatusMethodNotAllowed)
return
}
w.Header().Set("Content-Type", "text/plain")
w.WriteHeader(http.StatusOK)
w.Write([]byte("Hello world"))
}
func main() {
http.HandleFunc("/", helloHandler)
port := ":8080"
log.Printf("Server starting on port %s", port)
log.Fatal(http.ListenAndServe(port, nil))
}