Working on the actual web pages

This commit is contained in:
Caleb Gardner
2024-07-31 06:53:05 -05:00
parent f86cdb0554
commit 91c122e212
4 changed files with 46 additions and 5 deletions
+24
View File
@@ -1,6 +1,30 @@
package main
import (
"net/http"
"github.com/CalebQ42/darkstorm-server/internal/backend"
)
const (
blogTitle = "<h2 class='blog-title'>%v</h2>"
blogAuthor = "<h4 class='blog-author'><i>%v</i></h4>"
blogMain = "<p class='blog'>%v</p>"
)
func latestBlogsHandle(w http.ResponseWriter, r *http.Request) {}
func blogHandle(w http.ResponseWriter, r *http.Request, blog string) {
bl, err := blogApp.Blog(blog)
if err != nil {
if err == backend.ErrNotFound {
w.WriteHeader(404)
sendIndexWithContent(w, "Page not found")
return
}
w.WriteHeader(http.StatusInternalServerError)
sendIndexWithContent(w, "Error getting page")
return
}
}