craban/web/web.go
2021-09-12 00:32:07 +02:00

22 lines
351 B
Go

package web
import (
"fmt"
"net/http"
)
func NewWebServer(port int) (*http.Server, error) {
mux := http.NewServeMux()
// ToDo: configure routes
mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Hello rmsn!!")
})
s := &http.Server{
Addr: fmt.Sprintf(":%d", port),
Handler: mux,
}
return s, nil
}