Merge pull request 'Ajouter stylesheet /static/index.css pour /' (#20) from feature/css into main
Reviewed-on: #20
This commit is contained in:
commit
aab1dd5a62
5 changed files with 15 additions and 4 deletions
3
public/css/index.css
Normal file
3
public/css/index.css
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
body {
|
||||||
|
text-align: center;
|
||||||
|
}
|
|
@ -4,9 +4,7 @@
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>AGECEM</title>
|
<title>AGECEM</title>
|
||||||
<style>
|
<link rel="stylesheet" href="static/index.css">
|
||||||
body {text-align: center;}
|
|
||||||
</style>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1>Association Générale Étudiante du Cégep Édouard-Montpetit</h1>
|
<h1>Association Générale Étudiante du Cégep Édouard-Montpetit</h1>
|
||||||
|
|
|
@ -2,7 +2,7 @@ package public
|
||||||
|
|
||||||
import "embed"
|
import "embed"
|
||||||
|
|
||||||
//go:embed html/* scss/* js/*
|
//go:embed html/* css/* js/*
|
||||||
var embedFS embed.FS
|
var embedFS embed.FS
|
||||||
|
|
||||||
func GetEmbedFS() embed.FS {
|
func GetEmbedFS() embed.FS {
|
||||||
|
|
10
server.go
10
server.go
|
@ -46,6 +46,7 @@ func Execute() {
|
||||||
// HTML Routes
|
// HTML Routes
|
||||||
|
|
||||||
e.GET("/", handleIndex)
|
e.GET("/", handleIndex)
|
||||||
|
e.GET("/static/index.css", handleStaticCSSIndex)
|
||||||
|
|
||||||
e.Logger.Fatal(e.Start(":8080"))
|
e.Logger.Fatal(e.Start(":8080"))
|
||||||
}
|
}
|
||||||
|
@ -69,3 +70,12 @@ func handleV1(c echo.Context) error {
|
||||||
func handleIndex(c echo.Context) error {
|
func handleIndex(c echo.Context) error {
|
||||||
return c.Render(http.StatusOK, "index-html", nil)
|
return c.Render(http.StatusOK, "index-html", nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CSS Handlers
|
||||||
|
|
||||||
|
func handleStaticCSSIndex(c echo.Context) error {
|
||||||
|
// TODO Ajouter gestion d'erreurs
|
||||||
|
// TODO Ajouter support pour fichiers SCSS
|
||||||
|
data, _ := embedFS.ReadFile("css/index.css")
|
||||||
|
return c.Blob(http.StatusOK, "text/css", data)
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue