23 lines
351 B
Go
23 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
|
||
|
}
|