aboutsummaryrefslogtreecommitdiff
path: root/handle.go
diff options
context:
space:
mode:
authorthinkpadmaster <a.scerba02@gmail.com>2024-02-10 10:30:15 -0500
committerAlex Scerba <alex@scerba.org>2024-10-29 13:20:00 -0400
commit6a498c45332aad573d2a311dbcac9fabd8919378 (patch)
treeaa576e8d11ff39f8546e2a4dae39a53f60f91719 /handle.go
parent98f438ea7469e07cc4265d2e403f3a1f14b650b2 (diff)
Restyle and restructure
Diffstat (limited to 'handle.go')
-rw-r--r--handle.go36
1 files changed, 0 insertions, 36 deletions
diff --git a/handle.go b/handle.go
index bab3c70..7414665 100644
--- a/handle.go
+++ b/handle.go
@@ -27,48 +27,12 @@ func (app *application) home(w http.ResponseWriter, r *http.Request) {
}
}
-func (app *application) about(w http.ResponseWriter, r *http.Request) {
- w.Header().Set("Content-Type", "text/html; charset=utf-8")
-
- path := strings.Split(r.URL.Path, "/")
- pathLen := len(path)
-
- if pathLen == 3 && path[2] == "" {
- http.Redirect(w, r, "/about", http.StatusFound)
- return
- } else if pathLen == 3 && path[2] != "" || pathLen > 3 {
- app.notFound(w)
- return
- }
- err := renderTemplate(w, "main/about", nil)
- if err != nil {
- app.serverError(w, err)
- return
- }
-}
-
-func (app *application) aggregate(w http.ResponseWriter, r *http.Request) {
- w.Header().Set("Content-Type", "text/html; charset=utf-8")
-
- p, err := app.loadPosts("html"+strings.TrimSuffix(r.URL.Path, "/"), -1)
- if err != nil {
- app.notFound(w)
- }
-
- renderTemplate(w, "main/"+strings.TrimPrefix(strings.TrimSuffix(r.URL.Path, "/"), "/"), p)
-}
-
func (app *application) post(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "text/html; charset=utf-8")
path := strings.Split(r.URL.Path, "/")
if len(path) > 4 {
app.notFound(w)
- } else if r.URL.Path == "/projects" {
- app.aggregate(w, r)
- } else if path[2] == "" {
- http.Redirect(w, r, "/"+path[1], http.StatusFound)
- return
} else if len(path) == 4 && path[3] == "" {
http.Redirect(w, r, "/"+path[1]+"/"+path[2], http.StatusFound)
} else {