zaliczeniePP/main.go

37 lines
751 B
Go
Raw Normal View History

2018-11-21 23:47:31 +01:00
package main
2018-11-20 22:17:07 +01:00
2018-12-10 15:52:29 +01:00
import (
"fmt"
"html/template"
"log"
"net/http"
"strings"
)
2018-11-21 23:47:31 +01:00
2018-12-10 16:09:22 +01:00
type MyMux struct {
}
func (p *MyMux) ServeHTTP(w http.ResponseWriter, r *http.Request) {
if r.URL.Path == "/" {
sayhelloName(w, r)
return
2018-11-21 23:47:31 +01:00
}
2018-12-10 16:09:22 +01:00
http.NotFound(w, r)
return
}
func sayhelloName(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Hello myroute!")
2018-11-21 23:47:31 +01:00
}
2018-12-10 16:09:22 +01:00
//==============================================================================
//==============================================================================
2018-11-21 23:47:31 +01:00
func main() {
2018-12-10 16:09:22 +01:00
mux := &MyMux{}
http.ListenAndServe(":9090", mux)
2018-12-10 15:52:29 +01:00
err := http.ListenAndServe(":8080", nil) // ustaw port nasłuchiwania
if err != nil {
log.Fatal("ListenAndServe: ", err)
}
2018-11-21 23:47:31 +01:00
}