Skip to content

Commit

Permalink
add home route
Browse files Browse the repository at this point in the history
  • Loading branch information
samcal committed Jul 8, 2014
1 parent 8c3cc67 commit 6f2968a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions diet.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ type Item struct {

func main() {
r := mux.NewRouter()
r.HandleFunc("/", home)
r.HandleFunc("/feeds/hn/{min_points:[0-9]+}", hn)

http.Handle("/", r)
Expand All @@ -39,6 +40,10 @@ func main() {
http.ListenAndServe(":3000", nil)
}

func home(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("Hello!"))
}

func hn(w http.ResponseWriter, r *http.Request) {
params := mux.Vars(r)
min_points, _ := strconv.Atoi(params["min_points"])
Expand Down

0 comments on commit 6f2968a

Please sign in to comment.