Ajouter routes exemples selon figma #25

Merged
vlbeaudoin merged 3 commits from feature/squelette-routes into main 2023-03-24 18:28:37 -04:00

View file

@ -2,6 +2,7 @@ package main
import ( import (
"embed" "embed"
"fmt"
"html/template" "html/template"
"io" "io"
"net/http" "net/http"
@ -51,6 +52,20 @@ func Execute() {
e.GET("/", handleIndex) 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("/formulaires", handleFormulaires)
e.Logger.Fatal(e.Start(":8080")) e.Logger.Fatal(e.Start(":8080"))
} }
@ -74,6 +89,32 @@ func handleIndex(c echo.Context) error {
return c.Render(http.StatusOK, "index-html", nil) 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 handleFormulaires(c echo.Context) error {
return c.String(http.StatusOK, "Formulaires")
}
// CSS Handlers // CSS Handlers
func handleStaticCSSIndex(c echo.Context) error { func handleStaticCSSIndex(c echo.Context) error {