added go hello world and test
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
2020-12-01 10:34:22 +02:00
parent 2674bf7d5f
commit 9a2911b72b
2 changed files with 40 additions and 0 deletions

20
main.go Normal file
View File

@@ -0,0 +1,20 @@
package main
import (
"log"
"net/http"
)
type Server struct{}
func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
w.Header().Set("Content-Type", "application/json")
w.Write([]byte(`{"message": "hello world"}`))
}
func main() {
s := &Server{}
http.Handle("/", s)
log.Fatal(http.ListenAndServe(":8080", nil))
}

20
main_test.go Normal file
View File

@@ -0,0 +1,20 @@
package main
import (
"log"
"net/http"
)
type Server struct{}
func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
w.Header().Set("Content-Type", "application/json")
w.Write([]byte(`{"message": "hello world"}`))
}
func main() {
s := &Server{}
http.Handle("/", s)
log.Fatal(http.ListenAndServe(":8080", nil))
}