31 lines
413 B
Go
31 lines
413 B
Go
package http_internal
|
|
|
|
import "net/http"
|
|
|
|
type AppServer struct {
|
|
srv *http.Server
|
|
mux *http.ServeMux
|
|
}
|
|
|
|
func NewAppServer() *AppServer {
|
|
mux := http.NewServeMux()
|
|
|
|
fs := http.FileServer(http.Dir("web/"))
|
|
|
|
mux.Handle("/", fs)
|
|
|
|
srv := &http.Server{
|
|
Addr: "localhost:1234",
|
|
Handler: mux,
|
|
}
|
|
|
|
return &AppServer{
|
|
srv: srv,
|
|
mux: mux,
|
|
}
|
|
}
|
|
|
|
func (srv *AppServer) Start() {
|
|
srv.srv.ListenAndServe()
|
|
}
|