diff --git a/core.go b/core.go index 4409708..ee5f9c4 100644 --- a/core.go +++ b/core.go @@ -81,6 +81,20 @@ func (app *App) Run(router *httprouter.Router) { portNumber = "80" } router = app.RegisterRoutes(ResolveRouter().GetRoutes(), router) + + // check if template engine is enable + TemplateEnableStr := os.Getenv("TEMPLATE_ENABLE") + if TemplateEnableStr == "" { + TemplateEnableStr = "false" + } + TemplateEnable, _ := strconv.ParseBool(TemplateEnableStr) + // if enabled, add public path + if TemplateEnable { + + publicPath := os.Getenv("TEMPLATE_PUBLIC") + router.ServeFiles("/public/*filepath", http.Dir(publicPath)) + } + useHttpsStr := os.Getenv("App_USE_HTTPS") if useHttpsStr == "" { useHttpsStr = "false" @@ -93,6 +107,8 @@ func (app *App) Run(router *httprouter.Router) { } else { fmt.Printf("Listening on port %s\nWaiting for requests...\n", portNumber) } + + // check if use letsencrypt UseLetsEncryptStr := os.Getenv("App_USE_LETSENCRYPT") if UseLetsEncryptStr == "" { UseLetsEncryptStr = "false" @@ -135,6 +151,7 @@ func (app *App) RegisterRoutes(routes []Route, router *httprouter.Router) *httpr router.PanicHandler = panicHandler router.NotFound = notFoundHandler{} router.MethodNotAllowed = methodNotAllowed{} + for _, route := range routes { switch route.Method { case GET: