-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
41 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# jawsboot | ||
|
||
Provides a statically served and embedded version of [Bootstrap](https://getbootstrap.com/). | ||
|
||
Example usage that loads your templates, favicon and Bootstrap. Also uses the templatereloader | ||
so that when running with `-tags debug` or `-race` templates are reloaded from disk as needed. | ||
|
||
```go | ||
//go:embed assets | ||
var assetsFS embed.FS | ||
|
||
func setupRoutes(jw *jaws.Jaws, mux *http.ServeMux) (err error) { | ||
var tmpl jaws.TemplateLookuper | ||
if tmpl, err = templatereloader.New(assetsFS, "assets/ui/*.html", ""); err == nil { | ||
jw.AddTemplateLookuper(tmpl) | ||
var faviconuri string | ||
if faviconuri, err = staticserve.HandleFS(assetsFS, "assets", "static/images/favicon.png", mux.Handle); err == nil { | ||
if err = jawsboot.Setup(jw, mux.Handle, faviconuri); err == nil { | ||
// set up your other routes | ||
} | ||
} | ||
} | ||
return | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# staticserve | ||
|
||
`staticserve` is a cache-busting HTTP handler for static files. It supports | ||
GET operations requesting the file with no encoding or gzip encoding. | ||
|
||
For an example how to use it, see `jawsboot/README.md`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# templatereloader | ||
|
||
A templatereloader is a `jaws.TemplateLookuper` that will reload templates from | ||
disk as needed if running with `-tags debug` or `-race`. If not, it simply calls | ||
`template.New("").ParseFS(fsys, fpath)` and has no overhead. | ||
|
||
For example usage, see `jawsboot/README.md` |