24 lines
553 B
Go
24 lines
553 B
Go
|
package main
|
||
|
|
||
|
import (
|
||
|
"h4kor/owl-blogs"
|
||
|
"net/http"
|
||
|
|
||
|
"github.com/julienschmidt/httprouter"
|
||
|
)
|
||
|
|
||
|
func RepoIndexHandler(repo owl.Repository) func(http.ResponseWriter, *http.Request, httprouter.Params) {
|
||
|
return func(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
|
||
|
html, err := owl.RenderUserList(repo)
|
||
|
|
||
|
if err != nil {
|
||
|
println("Error rendering index: ", err.Error())
|
||
|
w.WriteHeader(http.StatusInternalServerError)
|
||
|
w.Write([]byte("Internal server error"))
|
||
|
return
|
||
|
}
|
||
|
println("Rendering index")
|
||
|
w.Write([]byte(html))
|
||
|
}
|
||
|
}
|