Added text export

This commit is contained in:
2021-11-22 22:41:53 +09:00
parent 9f133ee752
commit 093385b153
6 changed files with 107 additions and 2 deletions

17
pages/export/JSON.go Normal file
View File

@ -0,0 +1,17 @@
package export
import (
"github.com/aerogo/aero"
)
// JSON renders the anime list items in JSON format.
func JSON(ctx aero.Context) error {
animeList, err := getAnimeList(ctx)
if err != nil {
return err
}
ctx.Response().SetHeader("Content-Disposition", "attachment; filename=\"anime-list.json\"")
return ctx.JSON(animeList)
}