Skip to content

Commit

Permalink
server: disable /static in -dev mode
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Bezzubov <alexander.bezzubov@jetbrains.com>
  • Loading branch information
bzz committed Oct 27, 2020
1 parent 4bced70 commit 032c4d8
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions cmd/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,11 @@ func main() {
r.Get("/login", handleLogin)
r.Get("/login/authorized", handleAuth)

// static
workDir, _ := os.Getwd()
filesDir := http.Dir(filepath.Join(workDir, "frontend", "dist"))
FileServer(r, "/static", filesDir)
if !*dev { // static
workDir, _ := os.Getwd()
filesDir := http.Dir(filepath.Join(workDir, "frontend", "dist"))
FileServer(r, "/static", filesDir)
}

r.Route("/json", func(j chi.Router) {
j.Use(setContentType("application/json"))
Expand Down

0 comments on commit 032c4d8

Please sign in to comment.