예제 #1
0
파일: movies.go 프로젝트: rharter/mediaman
// 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()
}