-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
34 lines (28 loc) · 783 Bytes
/
main.go
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
package main
import (
"fmt"
"net/http"
"appengine"
"unit1"
"unit2"
"unit3"
"tools"
)
func init(){
h := new( tools.RegexpHandler)
h.HandleFunc("/",mainHandler)
h.HandleFunc("/unit1/date", unit1.DateHandler)
h.HandleFunc("/unit1/thanks", unit1.ThanksHandler)
h.HandleFunc("/unit2/rot13", unit2.Rot13Handler)
h.HandleFunc("/unit2/signup/?", unit2.SignupHandler)
h.HandleFunc("/unit2/welcome/?", unit2.WelcomeHandler)
h.HandleFunc("/blog/?", unit3.BlogFrontHandler)
h.HandleFunc("/blog/newpost", unit3.NewPostHandler)
h.HandleFunc("/blog/[0-9]+/?",unit3.PermalinkHandler)
http.Handle("/",h)
}
func mainHandler(w http.ResponseWriter, r *http.Request){
c := appengine.NewContext(r)
c.Infof("Requested URL: %v", r.URL)
fmt.Fprint(w,"hello Udacity with Go!")
}