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
Showing only changes of commit 3e4573d923 - Show all commits

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("/nous-contacter", handleNousContacter)
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 handleNousContacter(c echo.Context) error {
return c.String(http.StatusOK, "Nous Contacter")
}
// CSS Handlers // CSS Handlers
func handleStaticCSSIndex(c echo.Context) error { func handleStaticCSSIndex(c echo.Context) error {