diff --git a/WebFramework/Router/DefaultRouterBuilder.go b/WebFramework/Router/DefaultRouterBuilder.go index ffb6fa4f..d05e8a17 100644 --- a/WebFramework/Router/DefaultRouterBuilder.go +++ b/WebFramework/Router/DefaultRouterBuilder.go @@ -7,6 +7,7 @@ import ( "github.com/yoyofx/yoyogo/WebFramework/Context" "github.com/yoyofx/yoyogo/WebFramework/Mvc" "net/url" + "path" "strings" ) @@ -45,7 +46,7 @@ func (router *DefaultRouterBuilder) SetConfiguration(config Abstractions.IConfig mvcTemplate, hasTemplate := config.Get("yoyogo.application.server.mvc.template").(string) if hasTemplate { if hasPath { - mvcTemplate = serverPath + mvcTemplate + mvcTemplate = path.Join(serverPath, mvcTemplate) } router.mvcControllerBuilder.GetMvcOptions().MapRoute(mvcTemplate) router.log.Info("mvc.template: %s", ConsoleColors.Green(mvcTemplate)) diff --git a/WebFramework/WebApplicationBuilder.go b/WebFramework/WebApplicationBuilder.go index 6b69f1e6..5198dc3e 100644 --- a/WebFramework/WebApplicationBuilder.go +++ b/WebFramework/WebApplicationBuilder.go @@ -94,8 +94,10 @@ func (this *WebApplicationBuilder) buildMvc() { err := this.hostContext.HostServices.GetServiceByName(&viewEngine, "viewEngine") if err == nil { option := this.routerBuilder.GetMvcBuilder().GetRouterHandler().Options.ViewOption - viewEngine.SetTemplatePath(option) - controllerBuilder.SetViewEngine(viewEngine) + if option != nil { + viewEngine.SetTemplatePath(option) + controllerBuilder.SetViewEngine(viewEngine) + } } // add controllers to application services