Scrivener.Headers (scrivener_headers v3.2.2) View Source
Helpers for paginating API responses with Scrivener and HTTP headers. Implements RFC-5988, the proposed standard for Web linking.
Use paginate/2
to set the pagination headers:
def index(conn, params) do
page = MyApp.Person
|> where([p], p.age > 30)
|> order_by([p], desc: p.age)
|> preload(:friends)
|> MyApp.Repo.paginate(params)
conn
|> Scrivener.Headers.paginate(page)
|> render("index.json", people: page.entries)
end
Link to this section Summary
Functions
Add HTTP headers for a Scrivener.Page
.
Link to this section Functions
Specs
paginate(Plug.Conn.t(), Scrivener.Page.t(), opts :: keyword()) :: Plug.Conn.t()
Add HTTP headers for a Scrivener.Page
.