Exemplo n.º 1
0
// Display the homepage
func Home(w http.ResponseWriter, req *http.Request) {

	// Only accept the root path
	if req.URL.Path != "/" {
		http.NotFound(w, req)
		return
	}

	// Request the stories
	stories := session.FilteredStories(w, req, 0)

	// Display the index page
	index(w, stories)
}
Exemplo n.º 2
0
// Get the next page
func Next(w http.ResponseWriter, req *http.Request) {

	req.ParseForm()

	// Get the id of the next story to get
	qid := req.Form.Get("id")
	var storyid int64
	cnt, _ := fmt.Sscan(qid, &storyid)
	if cnt != 1 {
		storyid = 0
	}

	// Mark the stories up to here as being browsed
	session.MarkBrowsed(w, req, storyid)

	// Request more stories
	stories := session.FilteredStories(w, req, storyid)

	// Display the index page
	index(w, stories)

}