Add README and WIP server lifecycle
This commit is contained in:
parent
96bd6a8602
commit
19a2096193
7 changed files with 118 additions and 2 deletions
22
web/web.go
Normal file
22
web/web.go
Normal file
|
@ -0,0 +1,22 @@
|
|||
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
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue