summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'main.go')
-rw-r--r--main.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/main.go b/main.go
index d2e6600..11a96a7 100644
--- a/main.go
+++ b/main.go
@@ -1,8 +1,10 @@
package main
import (
+ "embed"
"fmt"
"html/template"
+ "io/fs"
"math"
"net/http"
"os"
@@ -16,6 +18,9 @@ var globalVariables = GlobalVars{
Name: "510K Search",
}
+//go:embed static/*
+var static embed.FS
+
func create_pdf_url(year string, knumber string) string {
year_int, _ := strconv.Atoi(year[0:2])
if year[0] == '0' || year[0] == '1' || year[0] == '2' || year[0] == '3' || year[0] == '4' || year[0] == '5' && year[0:2] != "01" && year[0:2] != "00" {
@@ -45,6 +50,8 @@ func main() {
Host: meili_host,
})
+ contentStatic, _ := fs.Sub(static, "static")
+
funcMap := template.FuncMap{
"unescapeHTML": func(s string) template.HTML {
return template.HTML(s)
@@ -62,6 +69,8 @@ func main() {
index := client.Index("510k")
+ http.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.FS(contentStatic))))
+
http.HandleFunc("/classic/", func(w http.ResponseWriter, r *http.Request) {
classicIndexTemplate.Execute(w, BaseResponse{
GlobalVars: globalVariables,