Multiple fixes and added article get endpoint for authors

This commit is contained in:
2022-02-02 16:00:56 +01:00
parent 6a6283f781
commit 3c8fd32345
11 changed files with 141 additions and 20 deletions

View File

@@ -9,6 +9,7 @@ import (
"github.com/gorilla/mux"
"html/template"
"net/http"
"path"
"path/filepath"
)
@@ -17,8 +18,8 @@ func main() {
r.StrictSlash(true)
var subrouter *mux.Router
if config.Path != "/" {
subrouter = r.PathPrefix(config.Path).Subrouter()
if config.SubPath != "" {
subrouter = r.PathPrefix(config.SubPath).Subrouter()
} else {
subrouter = r
}
@@ -69,7 +70,7 @@ func setupFrontend(r *mux.Router) {
r.Path("/").HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
landingpage.Execute(w, struct {
BasePath string
}{BasePath: config.Address + config.Path})
}{BasePath: config.Address + path.Join("/", config.SubPath)})
})
r.NotFoundHandler = http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {