// Copyright 2023 Harran Ali . All rights reserved. // Copyright (c) 2024 Zeni Kim // Use of this source code is governed by MIT-style // license that can be found in the LICENSE file. package controllers import ( "os" "strconv" "git.smarteching.com/goffee/core" "git.smarteching.com/goffee/core/template/components" ) // Show home page func WelcomeHome(c *core.Context) *core.Response { // check if template engine is enable TemplateEnableStr := os.Getenv("TEMPLATE_ENABLE") if TemplateEnableStr == "" { TemplateEnableStr = "false" } TemplateEnable, _ := strconv.ParseBool(TemplateEnableStr) if TemplateEnable { type templateData struct { TheTitle components.Title } tmplData := templateData{ TheTitle: components.Title{ Label: "Welcome to Goffee", }, } return c.Response.Template("basic.html", tmplData) } else { message := "{\"message\": \"Welcome to Goffee\"}" return c.Response.Json(message) } } // Show dashboard func WelcomeToDashboard(c *core.Context) *core.Response { message := "{\"message\": \"Welcome to Dashboard\"}" return c.Response.Json(message) }