refactor!: Déplacer fichiers statiques vers embed
Bump golang -> `1.21.4` Bump alpine -> `3.18.4` Exposer fichiers html sur `/*` Exposer fichiers css sur `/public/css/*` Exposer fichiers js sur `/public/js/*` Retirer prefix cgo de build step Ajouter `public/` à build step Retirer `public/static/` de `static/` dans run step Retirer mentions à static_dir dans `cmd/server.go` Retirer flag `server.static_dir`, `--static_dir` de serverCmd Retirer paramètre `static_dir` de `runServer` Remplacer middleware `RemoveTrailingSlash` -> `AddTrailingSlash` Ajouter `echo.Group`s pour exposition statique avec config Refactor déclaration de routes api derrière groupe `/api` Fix références de fichiers js et css dans `index.html` et `slider.js` BREAKING: static_dir n'est plus utilisé, les fichiers sont maintenant embedded
This commit is contained in:
parent
b68859f90b
commit
996aa67984
7 changed files with 43 additions and 25 deletions
|
@ -2,9 +2,17 @@ package public
|
|||
|
||||
import "embed"
|
||||
|
||||
//go:embed static/*
|
||||
var embedFS embed.FS
|
||||
//go:embed html/*
|
||||
var htmlFS embed.FS
|
||||
|
||||
func GetEmbedFS() embed.FS {
|
||||
return embedFS
|
||||
}
|
||||
func HTMLFS() embed.FS { return htmlFS }
|
||||
|
||||
//go:embed css/*
|
||||
var cssFS embed.FS
|
||||
|
||||
func CSSFS() embed.FS { return cssFS }
|
||||
|
||||
//go:embed js/*
|
||||
var jsFS embed.FS
|
||||
|
||||
func JSFS() embed.FS { return jsFS }
|
||||
|
|
|
@ -5,13 +5,13 @@
|
|||
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
|
||||
|
||||
<script src="slider.js"></script>
|
||||
<script src="/public/js/slider.js"></script>
|
||||
|
||||
<!-- BROKEN, brise slider.js quand inclu
|
||||
<script src="text.js"></script>
|
||||
!-->
|
||||
|
||||
<link rel="stylesheet" href="style.css">
|
||||
<link rel="stylesheet" href="/public/css/style.css">
|
||||
</head>
|
||||
|
||||
<body>
|
|
@ -6,7 +6,7 @@ function afficherIndex() {
|
|||
}
|
||||
|
||||
function afficherImage() {
|
||||
$('#image').attr('src', "api/contenu/"+images[indexImages]);
|
||||
$('#image').attr('src', "/api/contenu/"+images[indexImages]);
|
||||
}
|
||||
|
||||
function augmenterIndex() {
|
Loading…
Add table
Add a link
Reference in a new issue