lol před 2 roky
revize
3ee5c87c9c
1 změnil soubory, kde provedl 26 přidání a 0 odebrání
  1. 26 0
      main.go

+ 26 - 0
main.go

@@ -0,0 +1,26 @@
+package main
+
+import (
+	"fmt"
+	"log"
+	"net/http"
+)
+
+func sayhello(w http.ResponseWriter, r *http.Request) {
+	fmt.Fprintf(w, "HTTP-статус 200")
+}
+func sayinfo(w http.ResponseWriter, r *http.Request) {
+	fmt.Fprintf(w, "НИВ 794")
+}
+func sayOK(w http.ResponseWriter, r *http.Request) {
+	fmt.Fprintf(w, "OK")
+}
+func main() {
+	http.HandleFunc("/info", sayinfo)
+	http.HandleFunc("/", sayhello)
+	http.HandleFunc("/OK", sayOK)
+	err := http.ListenAndServe(":8080", nil) // устанавливаем порт веб-сервера
+	if err != nil {
+		log.Fatal("ListenAndServe: ", err)
+	}
+}