Пример #1
0
// Display a movie list
func MovieList(w http.ResponseWriter, r *http.Request) error {
	movies, err := database.ListMovies()
	if err != nil {
		return err
	}

	data := struct {
		Movies []*Movie `json:"movies"`
	}{movies}

	return RenderTemplate(w, r, "movies_list.html", &data)
}
Пример #2
0
// GET /api/movies
// Lists all movies
func MovieList(w http.ResponseWriter, r *http.Request) (interface{}, error) {
	return database.ListMovies()
}