From 3e4573d923e6a4341cb73e2e509cf8c3ec754353 Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Tue, 21 Mar 2023 20:29:06 -0400 Subject: [PATCH] WIP: Ajouter routes exemples selon figma MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Voir #17 pour définition des routes --- server.go | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/server.go b/server.go index 5b35034..b0c2a6d 100644 --- a/server.go +++ b/server.go @@ -2,6 +2,7 @@ package main import ( "embed" + "fmt" "html/template" "io" "net/http" @@ -51,6 +52,20 @@ func Execute() { e.GET("/", handleIndex) + e.GET("/a-propos", handleAPropos) + + e.GET("/actualite", handleActualite) + + e.GET("/actualite/:article", handleActualiteArticle) + + e.GET("/vie-etudiante", handleVieEtudiante) + + e.GET("/vie-etudiante/:organisme", handleVieEtudianteOrganisme) + + e.GET("/documentation", handleDocumentation) + + e.GET("/nous-contacter", handleNousContacter) + e.Logger.Fatal(e.Start(":8080")) } @@ -74,6 +89,32 @@ func handleIndex(c echo.Context) error { return c.Render(http.StatusOK, "index-html", nil) } +func handleAPropos(c echo.Context) error { + return c.String(http.StatusOK, "À Propos") +} + +func handleActualite(c echo.Context) error { + return c.String(http.StatusOK, "Actualité") +} + +func handleActualiteArticle(c echo.Context) error { + article := c.Param("article") + return c.String(http.StatusOK, fmt.Sprintf("Article: %s", article)) +} +func handleVieEtudiante(c echo.Context) error { + return c.String(http.StatusOK, "Vie Étudiante") +} +func handleVieEtudianteOrganisme(c echo.Context) error { + organisme := c.Param("organisme") + return c.String(http.StatusOK, fmt.Sprintf("Organisme: %s", organisme)) +} +func handleDocumentation(c echo.Context) error { + return c.String(http.StatusOK, "Documentation") +} +func handleNousContacter(c echo.Context) error { + return c.String(http.StatusOK, "Nous Contacter") +} + // CSS Handlers func handleStaticCSSIndex(c echo.Context) error {