From 0925899cee9362cf09e982487bd480e2b09041f4 Mon Sep 17 00:00:00 2001 From: Frédéric Guillot Date: Sun, 11 Nov 2018 10:22:47 -0800 Subject: Move API middleware and routes to api package --- api/opml.go | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'api/opml.go') diff --git a/api/opml.go b/api/opml.go index 199c0e7..e5af7c9 100644 --- a/api/opml.go +++ b/api/opml.go @@ -13,9 +13,8 @@ import ( "miniflux.app/reader/opml" ) -// Export is the API handler that export feeds to OPML. -func (c *Controller) Export(w http.ResponseWriter, r *http.Request) { - opmlHandler := opml.NewHandler(c.store) +func (h *handler) exportFeeds(w http.ResponseWriter, r *http.Request) { + opmlHandler := opml.NewHandler(h.store) opml, err := opmlHandler.Export(request.UserID(r)) if err != nil { json.ServerError(w, r, err) @@ -25,9 +24,8 @@ func (c *Controller) Export(w http.ResponseWriter, r *http.Request) { xml.OK(w, r, opml) } -// Import is the API handler that import an OPML file. -func (c *Controller) Import(w http.ResponseWriter, r *http.Request) { - opmlHandler := opml.NewHandler(c.store) +func (h *handler) importFeeds(w http.ResponseWriter, r *http.Request) { + opmlHandler := opml.NewHandler(h.store) err := opmlHandler.Import(request.UserID(r), r.Body) defer r.Body.Close() if err != nil { -- cgit v1.2.3