123456789101112131415161718192021222324252627282930313233 |
- package main
- import (
- "fmt"
- "log"
- "net/http"
- "strings"
- "time"
- )
- func main() {
- http.HandleFunc("/", slash) // Устанавливаем роутер
- http.HandleFunc("/ok", ok) // Устанавливаем роутер ok
- http.HandleFunc("/info", info) // Устанавливаем роутер info
- http.HandleFunc("/status", status) // Устанавливаем роутер info
- err := http.ListenAndServe("localhost:0808", nil) // устанавливаем порт веб-сервера
- if err != nil {
- log.Fatal("ListenAndServe: ", err)
- }
- }
- func slash (w http.ResponseWriter,r *http.Request) {
- fmt.Fprint(w,"it alive")
- }
- func ok (w http.ResponseWriter,r *http.Request) {
- w.WriteHeader(http.StatusOK)
- fmt.Fprint(w,"http status ok ")
- }
- func info (w http.ResponseWriter,r *http.Request) {
- fmt.Fprint(w,"LI Vladislave♂")
- }
|