Added embed, nix, and a makefile
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"embed"
|
||||
"log"
|
||||
"net/http"
|
||||
|
||||
@@ -8,13 +9,17 @@ import (
|
||||
"sprintpadawan/lib"
|
||||
)
|
||||
|
||||
//go:embed static templates
|
||||
var embeddedFiles embed.FS
|
||||
|
||||
func main() {
|
||||
lib.InitDB()
|
||||
api.InitTemplates(embeddedFiles)
|
||||
|
||||
mux := http.NewServeMux()
|
||||
|
||||
// serve static assets
|
||||
mux.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir("static"))))
|
||||
mux.Handle("/static/", http.FileServer(http.FS(embeddedFiles)))
|
||||
|
||||
api.SetupRoutes(mux)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user