Skip to content

Commit 27bfe61

Browse files
author
Vic Shóstak
committed
Update README.md
1 parent 55c4f63 commit 27bfe61

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ func handler(w http.ResponseWriter, r *http.Request) {
2626
indexPage := filepath.Join("templates", "pages", "index.html")
2727
indexLoginForm := filepath.Join("templates", "components", "index-login-form.html")
2828

29-
// Parse user templates or return error.
30-
tmpl, err := gowebly.ParseTemplates(indexPage, indexLoginForm) // gowebly helper
29+
// Parse user templates, using gowebly helper, or return error.
30+
tmpl, err := gowebly.ParseTemplates(indexPage, indexLoginForm)
3131
if err != nil {
3232
w.WriteHeader(http.StatusBadRequest)
3333
slog.Error(err.Error(), "method", r.Method, "status", http.StatusBadRequest, "path", r.URL.Path)
@@ -60,8 +60,11 @@ import (
6060
//go:embed static/*
6161
var static embed.FS
6262

63+
// Create the gowebly helper for serve embed static folder.
64+
staticFileServer := gowebly.StaticFileServerHandler(http.FS(static))
65+
6366
// Handle static files (with a custom handler).
64-
http.Handle("/static/", gowebly.StaticFileServerHandler(http.FS(static))) // gowebly helper
67+
http.Handle("/static/", staticFileServer)
6568
```
6669

6770
## ⚠️ License

0 commit comments

Comments
 (0)