|
@@ -0,0 +1,27 @@
|
|
|
|
+package main
|
|
|
|
+
|
|
|
|
+import (
|
|
|
|
+ "fmt"
|
|
|
|
+ "net/http"
|
|
|
|
+ "log"
|
|
|
|
+)
|
|
|
|
+func main() {
|
|
|
|
+ http.HandleFunc("/", sayhello) // Устанавливаем роутер
|
|
|
|
+ http.HandleFunc("/home", sayhello1)
|
|
|
|
+ http.HandleFunc("/omegalul", sayhello2)
|
|
|
|
+ err := http.ListenAndServe(":8080", nil) // устанавливаем порт веб-сервера
|
|
|
|
+ if err != nil {
|
|
|
|
+ log.Fatal("ListenAndServe: ", err)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+func sayhello(w http.ResponseWriter, r *http.Request) {
|
|
|
|
+ fmt.Fprintf(w, "Привет!")
|
|
|
|
+}
|
|
|
|
+func sayhello1(w http.ResponseWriter, r *http.Request) {
|
|
|
|
+ fmt.Fprintf(w, "darova ept eto home!")
|
|
|
|
+}
|
|
|
|
+func sayhello2(w http.ResponseWriter, r *http.Request) {
|
|
|
|
+ fmt.Fprintf(w, "kekwait")
|
|
|
|
+}
|
|
|
|
+
|