From 6442e46f13e3107cf2ca598fbcfc72d51ea9bb78 Mon Sep 17 00:00:00 2001 From: Lizandro Guarnizo <77708265+lizandrogd@users.noreply.github.com> Date: Thu, 6 Feb 2025 14:49:52 -0500 Subject: [PATCH] update --- resources/views/dashboard.html | 22 ---------- resources/views/index.html | 28 ++++++++---- resources/views/layouts/public.html | 64 ++++++++++++++++++++++++++++ rest/controllers/index_controller.go | 22 ++++++++++ rest/routes/publicas.go | 18 ++++++++ rest/routes/routes.go | 16 ------- rest/routes/web.go | 2 + 7 files changed, 126 insertions(+), 46 deletions(-) delete mode 100644 resources/views/dashboard.html create mode 100644 resources/views/layouts/public.html create mode 100644 rest/controllers/index_controller.go create mode 100644 rest/routes/publicas.go diff --git a/resources/views/dashboard.html b/resources/views/dashboard.html deleted file mode 100644 index 986c34f..0000000 --- a/resources/views/dashboard.html +++ /dev/null @@ -1,22 +0,0 @@ - -
-
-

Oficina Virtual

-
-

Bienvenido a la oficina virtual de GASES DEL ORIENTE S.A E.S.P

- - - - -
- Cargando... -
- - -
\ No newline at end of file diff --git a/resources/views/index.html b/resources/views/index.html index 7d72aa3..65b484c 100644 --- a/resources/views/index.html +++ b/resources/views/index.html @@ -1,10 +1,22 @@ -

{{.Title}}

-{{if .user}} -Hello, {{.user.FirstName}} - ID: {{.user.ID}}! + +
+
+

Oficina Virtual

+
+

Bienvenido a la oficina virtual de Usite

+ + + + +
+ Cargando... +
- -{{end}} - - -{{template "partials/footer" .}} +
\ No newline at end of file diff --git a/resources/views/layouts/public.html b/resources/views/layouts/public.html new file mode 100644 index 0000000..07ff22f --- /dev/null +++ b/resources/views/layouts/public.html @@ -0,0 +1,64 @@ + + + + + + + Gases del Oriente + + + + + + + + + + + +
+
+ {{embed}} +
+
+ + + + + + + \ No newline at end of file diff --git a/rest/controllers/index_controller.go b/rest/controllers/index_controller.go new file mode 100644 index 0000000..87369a8 --- /dev/null +++ b/rest/controllers/index_controller.go @@ -0,0 +1,22 @@ +package controllers + +import ( + "github.com/gofiber/fiber/v2" +) + +// RENDER +func Index(c *fiber.Ctx) error { + data := fiber.Map{ + //"user": c.Locals("user").(map[string]interface{}), + //"modules": c.Locals("userModules"), + } + + // Renderiza la vista con el layout layouts/main + if err := c.Render("index", data, "layouts/public"); err != nil { + return c.Status(fiber.StatusInternalServerError).JSON(fiber.Map{ + "message": "Error rendering template", + "error": err.Error(), + }) + } + return nil +} diff --git a/rest/routes/publicas.go b/rest/routes/publicas.go new file mode 100644 index 0000000..cd61410 --- /dev/null +++ b/rest/routes/publicas.go @@ -0,0 +1,18 @@ +package routes + +import ( + "github.com/gofiber/fiber/v2" + "github.com/sujit-baniya/fiber-boilerplate/rest/controllers" + "github.com/sujit-baniya/fiber-boilerplate/rest/middlewares" +) + +func RutasPublicas(web fiber.Router) { + //web.Get("/", controllers.Landing) + web.Get("/index", controllers.Index) + web.Get("/ping", Pong) + web.Get("/all-routes", AllRoutes) + web.Get("/do/verify-email", middlewares.ValidateConfirmToken, controllers.VerifyRegisteredEmail) + + +} + diff --git a/rest/routes/routes.go b/rest/routes/routes.go index 09d1a6f..5a1a6e7 100644 --- a/rest/routes/routes.go +++ b/rest/routes/routes.go @@ -15,20 +15,4 @@ func LoadRoutes(app *fiber.App) { // Rutas del backend (web) WebRoutes(web) - vue := app.Group("") - // Sirve archivos estáticos de Vue.js desde la carpeta 'dist' - vue.Static("/", "./dist") // Sirve archivos estáticos de Vue.js - - // Ruta para acceder a los archivos subidos - vue.Get("/uploads/:filename", func(c *fiber.Ctx) error { - filename := c.Params("filename") - // Devuelve el archivo solicitado desde 'uploads' - return c.SendFile("./uploads/" + filename) - }) - - // Ruta wildcard para manejar las rutas del frontend (SPA) - vue.Get("/*", func(c *fiber.Ctx) error { - return c.SendFile("./dist/index.html") - }) - } diff --git a/rest/routes/web.go b/rest/routes/web.go index 65c03ae..dae6cdc 100644 --- a/rest/routes/web.go +++ b/rest/routes/web.go @@ -9,6 +9,8 @@ import ( func WebRoutes(web fiber.Router) { // Aplicar el middleware para desactivar el caché web.Use(middlewares.LoadCacheHeaders) + //publicas + RutasPublicas(web) // Rutas específicas del backend LandingRoutes(web) WebAuthRoutes(web)