Browse Source

Загрузить файлы ''

gr792_mma 2 years ago
parent
commit
318fc1a351
1 changed files with 23 additions and 0 deletions
  1. 23 0
      test.go

+ 23 - 0
test.go

@@ -0,0 +1,23 @@
+package main
+
+import (
+	"fmt"
+	"log"
+	"net/http"
+)
+
+func main() {
+	http.HandleFunc("/ok", sayhello)
+	http.HandleFunc("/info", sayhello1)
+	err := http.ListenAndServe(":8080", nil)
+	if err != nil {
+		log.Fatal("ListenAndServe: ", err)
+	}
+}
+func sayhello(w http.ResponseWriter, r *http.Request) {
+	fmt.Fprintf(w, "ok")
+	w.WriteHeader(200)
+}
+func sayhello1(w http.ResponseWriter, r *http.Request) {
+	fmt.Fprintf(w, "Морозов М.А. 792")
+}