Refactor server: use render func for templates
This commit is contained in:
parent
ca4e448f82
commit
a7bd1478bf
6 changed files with 60 additions and 39 deletions
13
server/errors.go
Normal file
13
server/errors.go
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
package server
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func errorPage(err error, status int) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
w.WriteHeader(status)
|
||||
fmt.Fprint(w, err.Error())
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue