Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 22f7d9b

Browse files
committed
ensure routes are loaded before returning. revel#883
1 parent ed3ec0f commit 22f7d9b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

router.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,9 +423,10 @@ func (router *Router) Reverse(action string, argValues map[string]string) *Actio
423423
func init() {
424424
OnAppStart(func() {
425425
MainRouter = NewRouter(path.Join(BasePath, "conf", "routes"))
426+
err := MainRouter.Refresh()
426427
if MainWatcher != nil && Config.BoolDefault("watch.routes", true) {
427428
MainWatcher.Listen(MainRouter, MainRouter.path)
428-
} else if err := MainRouter.Refresh(); err != nil {
429+
} else if err != nil {
429430
// Not in dev mode and Route loading failed, we should crash.
430431
ERROR.Panicln(err.Error())
431432
}

0 commit comments

Comments
 (0)