add document root
This commit is contained in:
parent
4b346afaec
commit
c42b2317d6
|
@ -4,7 +4,8 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"embed"
|
"embed"
|
||||||
"flag"
|
"flag"
|
||||||
"net/http"
|
"git.nspix.com/golang/kos/entry/http"
|
||||||
|
httpkg "net/http"
|
||||||
|
|
||||||
"git.nspix.com/golang/kos"
|
"git.nspix.com/golang/kos"
|
||||||
)
|
)
|
||||||
|
@ -16,7 +17,10 @@ type subServer struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *subServer) Start(ctx context.Context) (err error) {
|
func (s *subServer) Start(ctx context.Context) (err error) {
|
||||||
kos.Http().Root("/web", http.FS(webDir))
|
kos.Http().Root("/web", httpkg.FS(webDir))
|
||||||
|
kos.Http().Handle(httpkg.MethodGet, "/hello", func(ctx *http.Context) (err error) {
|
||||||
|
return ctx.Success("Hello World")
|
||||||
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue