Multiple fixes and added article get endpoint for authors
This commit is contained in:
7
main.go
7
main.go
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user