Made assets accessible
This commit is contained in:
@@ -3,6 +3,8 @@ package frontend
|
|||||||
import (
|
import (
|
||||||
"html/template"
|
"html/template"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"path/filepath"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
var dashbaord = template.Must(template.ParseFiles(
|
var dashbaord = template.Must(template.ParseFiles(
|
||||||
@@ -33,3 +35,8 @@ func Dashboard(w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
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>
|
<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>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
@@ -77,6 +77,9 @@ func (this *Server) Run() {
|
|||||||
mux.HandleFunc("/api/stock/add", handlers.AddStock)
|
mux.HandleFunc("/api/stock/add", handlers.AddStock)
|
||||||
mux.HandleFunc("/api/project-items/add", handlers.AllocateToProject)
|
mux.HandleFunc("/api/project-items/add", handlers.AllocateToProject)
|
||||||
|
|
||||||
|
// Assets
|
||||||
|
mux.HandleFunc("/assets/", frontend.Assets)
|
||||||
|
|
||||||
// Login required
|
// Login required
|
||||||
|
|
||||||
// Admin-only
|
// Admin-only
|
||||||
|
|||||||
Reference in New Issue
Block a user