Add basic web serving and html templating
This commit is contained in:
parent
18113ea4ee
commit
25039a8f54
8 changed files with 190 additions and 2 deletions
17
endpoint.go
Normal file
17
endpoint.go
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
)
|
||||
func getFavicon(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Content-type", "image/x-icon")
|
||||
|
||||
http.ServeFile(w, r, "static/favicon.ico")
|
||||
}
|
||||
|
||||
func getRoot(w http.ResponseWriter, r *http.Request) {
|
||||
err := htmlRoot(w, r.URL.Path)
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue