29 lines
No EOL
554 B
Go
29 lines
No EOL
554 B
Go
package sample
|
|
|
|
import (
|
|
"embed"
|
|
"github.com/go-chi/chi/v5"
|
|
"github.com/unrolled/render"
|
|
"net/http"
|
|
)
|
|
|
|
// content holds our static web server content.
|
|
//go:embed templates/*
|
|
var webserver embed.FS
|
|
|
|
var ren *render.Render
|
|
|
|
func Register(router chi.Router) {
|
|
ren = render.New(render.Options{
|
|
//Layout: "layout",
|
|
FileSystem: &render.EmbedFileSystem{
|
|
FS: webserver,
|
|
},
|
|
})
|
|
|
|
router.Get("/sample", sampleCall)
|
|
}
|
|
|
|
func sampleCall(w http.ResponseWriter, r *http.Request) {
|
|
ren.HTML(w, http.StatusOK, "ssp", map[string]string {"title": "World"})
|
|
} |