-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain_controller.go
More file actions
57 lines (49 loc) · 1.32 KB
/
Copy pathmain_controller.go
File metadata and controls
57 lines (49 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package main
import (
"log"
"net/http"
)
/********************************************************
* View Handler
*/
func viewHandler(w http.ResponseWriter, r *http.Request) {
log.Println("viewHandler was called")
}
/********************************************************
* About Handler
*/
func aboutHandler(w http.ResponseWriter, r *http.Request) {
RenderTemplate(w, r, "index/about", nil)
}
/********************************************************
* Edit Handler
*/
func editHandler(w http.ResponseWriter, r *http.Request) {
//Saving for sample code
/*title := r.URL.Path[len("/edit/"):]
p, err := loadPage(title)
if err != nil {
p = &Page{Title: title}
}
renderTemplate(w, "edit", p)*/
}
/********************************************************
* Contact Handler
*/
func contactHandler(w http.ResponseWriter, r *http.Request) {
RenderTemplate(w, r, "index/contact", nil)
}
/********************************************************
* Index Handler
*/
func indexHandler(w http.ResponseWriter, r *http.Request) {
RenderTemplate(w, r, "index/home", nil)
}
/*****
* This NotFound structure is used so that the mux not found handler
* passes along the request to subsequent handlers when a
* URL pattern does not match
*/
type NotFound struct{}
func (n *NotFound) ServeHTTP(w http.ResponseWriter, r *http.Request) {
}