Browse Source

first commit

gr794_gan 2 years ago
commit
fe31c9428d
1 changed files with 25 additions and 0 deletions
  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)
+
+	}
+
+}