main.go 689 B

123456789101112131415161718192021222324252627282930313233
  1. package main
  2. import (
  3. "fmt"
  4. "log"
  5. "net/http"
  6. "time"
  7. )
  8. func main() {
  9. http.HandleFunc("/IaSdam", IaSdam)
  10. http.HandleFunc("/HTTP200", HTTP200)
  11. http.HandleFunc("/SkolkoVremeni", SkolkoVremeni)
  12. err := http.ListenAndServe(":8080", nil)
  13. if err != nil {
  14. log.Fatal("ListenAndServe: ", err)
  15. }
  16. }
  17. func HTTP200(w http.ResponseWriter, r *http.Request) {
  18. w.WriteHeader(200)
  19. fmt.Fprintf(w, "status")
  20. }
  21. func IaSdam(w http.ResponseWriter, r *http.Request) {
  22. fmt.Fprintf(w, "Ложников Н.С."+"\n")
  23. fmt.Fprintf(w, "МДК.02.03.ОАКС"+"\n")
  24. }
  25. func SkolkoVremeni(w http.ResponseWriter, r *http.Request){
  26. time := time.Now()
  27. fmt.Fprintln(w, time.Format("2006-01-02 3:4:5 pm"))
  28. }