craban/web/web.go

23 lines
351 B
Go
Raw Normal View History

2021-09-11 23:32:07 +01:00
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
}