You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

46 lines
771 B

package Webserver
import (
"log"
"net/http"
"PersonalWebsite/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)
}