package main
import (
"fmt"
"html/template"
"log"
"net/http"
"strings"
)
type MyMux struct {
}
func (p *MyMux) ServeHTTP(w http.ResponseWriter, r *http.Request) {
if r.URL.Path == "/" {
sayhelloName(w, r)
return
}
http.NotFound(w, r)
return
}
func sayhelloName(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Hello myroute!")
}
//==============================================================================
//==============================================================================
func main() {
mux := &MyMux{}
http.ListenAndServe(":9090", mux)
err := http.ListenAndServe(":8080", nil) // ustaw port nasłuchiwania
if err != nil {
log.Fatal("ListenAndServe: ", err)
}
}