Ver código fonte

first commit

gr794_gan 2 anos atrás
commit
fe31c9428d
1 arquivos alterados com 25 adições e 0 exclusões
  1. 25 0
      main.go

+ 25 - 0
main.go

@@ -0,0 +1,25 @@
+package main
+
+import (
+	"fmt"
+	"log"
+	"net/http"
+)
+
+func sayhello(w http.ResponseWriter, r *http.Request) {
+	fmt.Fprintf(w, "gr794_Жвавий Артур!")
+}
+func say(w http.ResponseWriter, r *http.Request) {
+	fmt.Fprintf(w, "OK")
+}
+
+func main() {
+	http.HandleFunc("/", sayhello)
+	http.HandleFunc("/2страница", say)       // Устанавливаем роутер
+	err := http.ListenAndServe(":8080", nil) // устанавливаем порт веб-сервера
+	if err != nil {
+		log.Fatal("ListenAndServe: ", err)
+
+	}
+
+}