|
@@ -0,0 +1,24 @@
|
|
|
|
+package main
|
|
|
|
+
|
|
|
|
+import (
|
|
|
|
+ "fmt"
|
|
|
|
+ "log"
|
|
|
|
+ "net/http"
|
|
|
|
+)
|
|
|
|
+
|
|
|
|
+func main() {
|
|
|
|
+ http.HandleFunc("/info", sayhello) //сама страница
|
|
|
|
+ http.HandleFunc("/Ok", ok)
|
|
|
|
+ err := http.ListenAndServe(":8080", nil)
|
|
|
|
+ if err != nil {
|
|
|
|
+ log.Fatal("ListenAndServe: ", err) //выводит ошибку 404
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+func sayhello(w http.ResponseWriter, r *http.Request) {
|
|
|
|
+ fmt.Fprintf(w, "Hello world im Kirill 792")
|
|
|
|
+}
|
|
|
|
+func ok(w http.ResponseWriter, r *http.Request) {
|
|
|
|
+ fmt.Fprintf(w, "http status: 200 Ok")
|
|
|
|
+}
|