summaryrefslogtreecommitdiffstats
path: root/web/web.go
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2016-03-14 08:50:46 -0400
committerChristopher Speller <crspeller@gmail.com>2016-03-16 18:02:55 -0400
commit12896bd23eeba79884245c1c29fdc568cf21a7fa (patch)
tree4e7f83d3e2564b9b89d669e9f7905ff11768b11a /web/web.go
parent29fe6a3d13c9c7aa490fffebbe5d1b5fdf1e3090 (diff)
downloadchat-12896bd23eeba79884245c1c29fdc568cf21a7fa.tar.gz
chat-12896bd23eeba79884245c1c29fdc568cf21a7fa.tar.bz2
chat-12896bd23eeba79884245c1c29fdc568cf21a7fa.zip
Converting to Webpack. Stage 1.
Diffstat (limited to 'web/web.go')
-rw-r--r--web/web.go16
1 files changed, 7 insertions, 9 deletions
diff --git a/web/web.go b/web/web.go
index 2a44ece00..86b642f3b 100644
--- a/web/web.go
+++ b/web/web.go
@@ -14,13 +14,17 @@ import (
"github.com/mssola/user_agent"
)
+const (
+ CLIENT_DIR = "webapp/dist"
+)
+
func InitWeb() {
l4g.Debug(utils.T("web.init.debug"))
mainrouter := api.Srv.Router
- staticDir := utils.FindDir("web/static")
- l4g.Debug("Using static directory at %v", staticDir)
+ staticDir := utils.FindDir(CLIENT_DIR)
+ l4g.Debug("Using client directory at %v", staticDir)
mainrouter.PathPrefix("/static/").Handler(http.StripPrefix("/static/", http.FileServer(http.Dir(staticDir))))
mainrouter.Handle("/{anything:.*}", api.AppHandlerIndependent(root)).Methods("GET")
@@ -47,14 +51,8 @@ func CheckBrowserCompatability(c *api.Context, r *http.Request) bool {
}
func root(c *api.Context, w http.ResponseWriter, r *http.Request) {
-
if !CheckBrowserCompatability(c, r) {
return
}
-
- page := utils.NewHTMLTemplate("root", c.Locale)
- page.Props["Title"] = c.T("web.root.home_title")
- if err := page.RenderToWriter(w); err != nil {
- c.SetUnknownError(page.TemplateName, err.Error())
- }
+ http.ServeFile(w, r, utils.FindDir(CLIENT_DIR)+"root.html")
}