ARGON 2 年之前
当前提交
8cacfe14a2
共有 1 个文件被更改,包括 23 次插入0 次删除
  1. 23 0
      test.go

+ 23 - 0
test.go

@@ -0,0 +1,23 @@
+package main
+
+import (
+	"fmt"
+	"log"
+	"net/http"
+)
+
+func main() {
+	http.HandleFunc("/ok", sayhello)
+	http.HandleFunc("/info", sayhello1)
+	err := http.ListenAndServe(":8080", nil)
+	if err != nil {
+		log.Fatal("ListenAndServe: ", err)
+	}
+}
+func sayhello(w http.ResponseWriter, r *http.Request) {
+	fmt.Fprintf(w, "ok")
+	w.WriteHeader(200)
+}
+func sayhello1(w http.ResponseWriter, r *http.Request) {
+	fmt.Fprintf(w, "Морозов М.А. 792")
+}