forked from mbk-lab/rui_orig
описание
This commit is contained in:
parent
d4831bb68d
commit
d8ab76da20
|
@ -20,6 +20,25 @@ func (h *httpHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
NewHandler используется для встраивания приложения rui в сторонние WEB-фреймворки (net/http, gin, echo...).
|
||||||
|
Пример для echo:
|
||||||
|
|
||||||
|
e := echo.New()
|
||||||
|
e.Any(`/ui/*`, func()echo.HandlerFunc{
|
||||||
|
rui.AddEmbedResources(&resources)
|
||||||
|
|
||||||
|
h := rui.NewHandler("/ui", CreateSessionContent, rui.AppParams{
|
||||||
|
Title: `Awesome app`,
|
||||||
|
Icon: `favicon.png`,
|
||||||
|
})
|
||||||
|
|
||||||
|
return func(c echo.Context) error {
|
||||||
|
h.ServeHTTP(c.Response(), c.Request())
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
})
|
||||||
|
*/
|
||||||
func NewHandler(urlPrefix string, createContentFunc func(Session) SessionContent, params AppParams) *httpHandler {
|
func NewHandler(urlPrefix string, createContentFunc func(Session) SessionContent, params AppParams) *httpHandler {
|
||||||
app := new(application)
|
app := new(application)
|
||||||
app.params = params
|
app.params = params
|
||||||
|
|
Loading…
Reference in New Issue