Made assets accessible
This commit is contained in:
@@ -3,6 +3,8 @@ package frontend
|
||||
import (
|
||||
"html/template"
|
||||
"net/http"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
)
|
||||
|
||||
var dashbaord = template.Must(template.ParseFiles(
|
||||
@@ -33,3 +35,8 @@ func Dashboard(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
func Assets(w http.ResponseWriter, r *http.Request) {
|
||||
path := strings.TrimPrefix(r.URL.Path, "/assets/")
|
||||
http.ServeFile(w, r, filepath.Join("frontend/assets", path))
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
<script src="https://unpkg.com/htmx.org@2.0.4"></script>
|
||||
|
||||
<link rel="stylesheet" href="/static/css/app.css">
|
||||
<link rel="stylesheet" href="/assets/css/dashboard.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
@@ -77,6 +77,9 @@ func (this *Server) Run() {
|
||||
mux.HandleFunc("/api/stock/add", handlers.AddStock)
|
||||
mux.HandleFunc("/api/project-items/add", handlers.AllocateToProject)
|
||||
|
||||
// Assets
|
||||
mux.HandleFunc("/assets/", frontend.Assets)
|
||||
|
||||
// Login required
|
||||
|
||||
// Admin-only
|
||||
|
||||
Reference in New Issue
Block a user