Api

io.eezo.http.Api
See theApi companion object
trait Api[A]

The five JSON routes a model mounts for a program: index, show, create, update and destroy.

A sibling of Resource rather than a part of it, because a model may want either without the other: a back office with no program calling it has no use for JSON, and a model only a mobile client reads has no use for pages. What the two share they share by construction, not by agreement: the same plural off the class name, the same Actions, the same declaration and the same store, so the HTML seven and the JSON five of one model read and write the same rows under the same rules.

derives Api needs a Mirror, an api.Serde and an Actions, and no Form: JSON is read and written by the Serde, and nothing here renders a page. The Serde is summoned where the model derives, which is what keeps the JSON library out of http: the application chose an adapter, imported its given, and that given is the only code that sees the library.

There is no JSON route for New or Edit. Both serve a blank or filled form for a browser to submit, and a program builds its own body, so subtracting either changes nothing here.

Attributes

Companion
object
Source
Api.scala
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Abstract methods

def routes(store: Store[A], guarded: Guarded[A] = ...): Seq[Route]

The routes, in dispatch order.

The routes, in dispatch order.

The same signature as Resource.routes, so the generated route table hands both the same store and the same declaration, and the two cannot disagree about either.

Attributes

Source
Api.scala