Enabling static files

This commit is contained in:
Muyao CHEN 2024-06-28 22:30:19 +02:00
parent c15e4da93c
commit 6e6b003e05
5 changed files with 4 additions and 0 deletions

View File

@ -20,5 +20,8 @@ func routes(app *config.AppConfig) http.Handler {
mux.Get("/", handlers.Repo.Home)
mux.Get("/about", handlers.Repo.About)
fileServer := http.FileServer(http.Dir("./static/"))
mux.Handle("/static/*", http.StripPrefix("/static", fileServer))
return mux
}

BIN
static/images/outside.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 MiB

BIN
static/images/tray.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

View File

@ -5,6 +5,7 @@
<div class="col">
<h1>This is the home page</h1>
<p>This is the content</p>
<img src="/static/images/outside.png" alt="outside image" height="1330" width="2364">
</div>
</div>
</div>