package webserver
|
|
|
|
import (
|
|
"log"
|
|
"net/http"
|
|
|
|
"git.tovijaeschke.xyz/tovi/personal_website/database"
|
|
)
|
|
|
|
func ViewIndex(w http.ResponseWriter, r *http.Request) {
|
|
var (
|
|
v = make(map[string]interface{})
|
|
e error
|
|
)
|
|
|
|
v["PageView"] = "index-intro.gohtml"
|
|
v["Posts"], e = database.GetPostsList(5, 0)
|
|
if e != nil {
|
|
log.Println(e)
|
|
http.Redirect(w, r, "/error", 302)
|
|
}
|
|
|
|
ServeTemplate(w, r, "html/index.gohtml", v)
|
|
}
|
|
|
|
func ViewLinks(w http.ResponseWriter, r *http.Request) {
|
|
var (
|
|
v = make(map[string]interface{})
|
|
)
|
|
|
|
v["PageView"] = "index-links.gohtml"
|
|
|
|
ServeTemplate(w, r, "html/index.gohtml", v)
|
|
|
|
}
|
|
|
|
func ViewError(w http.ResponseWriter, r *http.Request) {
|
|
var (
|
|
v = make(map[string]interface{})
|
|
)
|
|
|
|
v["PageView"] = "error.gohtml"
|
|
|
|
ServeTemplate(w, r, "html/index.gohtml", v)
|
|
|
|
}
|