예제 #1
0
// Display a library list
func LibraryList(w http.ResponseWriter, r *http.Request) error {
	libraries, err := database.ListLibraries()
	if err != nil {
		return err
	}

	data := struct {
		Libraries []*Library `json:"libraries"`
	}{libraries}

	return RenderTemplate(w, r, "list_libraries.html", &data)
}
예제 #2
0
// GET /libraries
// returns a list of libraries
func LibraryList(w http.ResponseWriter, r *http.Request) (interface{}, error) {
	return database.ListLibraries()
}