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.
 
 
 

30 lines
487 B

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)
}