Fixing more stuff
This commit is contained in:
11
main.go
11
main.go
@@ -62,18 +62,19 @@ func setupApi(r *mux.Router) {
|
||||
|
||||
func setupFrontend(r *mux.Router) {
|
||||
r.HandleFunc("/article/{article}", server.Article).Methods(http.MethodGet)
|
||||
r.HandleFunc("/assets/{asset}", server.Assets).Methods(http.MethodGet)
|
||||
|
||||
r.PathPrefix("/css/").HandlerFunc(server.ServePath)
|
||||
r.PathPrefix("/img/").HandlerFunc(server.ServePath)
|
||||
r.PathPrefix("/js/").HandlerFunc(server.ServePath)
|
||||
r.PathPrefix("/html/").HandlerFunc(server.ServePath)
|
||||
r.PathPrefix("/css/").HandlerFunc(server.ServePath).Methods(http.MethodGet)
|
||||
r.PathPrefix("/img/").HandlerFunc(server.ServePath).Methods(http.MethodGet)
|
||||
r.PathPrefix("/js/").HandlerFunc(server.ServePath).Methods(http.MethodGet)
|
||||
r.PathPrefix("/html/").HandlerFunc(server.ServePath).Methods(http.MethodGet)
|
||||
|
||||
landingpage := template.Must(template.ParseFiles(filepath.Join(config.FrontendDir, "html", "landingpage.gohtml")))
|
||||
r.Path("/").HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
landingpage.Execute(w, struct {
|
||||
BasePath string
|
||||
}{BasePath: config.Address + strings.TrimSuffix(path.Join("/", config.SubPath), "/") + "/"})
|
||||
})
|
||||
}).Methods(http.MethodGet)
|
||||
|
||||
r.NotFoundHandler = http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
server.Error404(w, r)
|
||||
|
||||
Reference in New Issue
Block a user