1234567891011121314151617181920212223 |
- 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")
- }
|