|
|
- package Webserver
-
- import (
- "log"
- "net/http"
-
- "PersonalWebsite/Database"
-
- "github.com/gorilla/mux"
- )
-
- func ViewPost(w http.ResponseWriter, r *http.Request) {
- var (
- urlParams map[string]string
- post Database.Post
- e error
- )
-
- urlParams = mux.Vars(r)
-
- post, e = Database.GetPostById(urlParams["id"])
- if e != nil {
- // TODO: Forward 404
- log.Println("Could not get user")
- http.Error(w, "Error", http.StatusInternalServerError)
- return
- }
-
- log.Println(post)
- }
|