main.go 539 B

12345678910111213141516171819202122232425
  1. package main
  2. import (
  3. "fmt"
  4. "log"
  5. "net/http"
  6. )
  7. func sayhello(w http.ResponseWriter, r *http.Request) {
  8. fmt.Fprintf(w, "gr794_Жвавий Артур!")
  9. }
  10. func say(w http.ResponseWriter, r *http.Request) {
  11. fmt.Fprintf(w, "OK")
  12. }
  13. func main() {
  14. http.HandleFunc("/", sayhello)
  15. http.HandleFunc("/2страница", say) // Устанавливаем роутер
  16. err := http.ListenAndServe(":8080", nil) // устанавливаем порт веб-сервера
  17. if err != nil {
  18. log.Fatal("ListenAndServe: ", err)
  19. }
  20. }