server library
JSON:API server on top of dart:io.
Classes
- Controller
- JSON:API controller
- ControllerRouter
- ErrorConverter
-
The error converter maps server exceptions to JSON:API responses.
It is designed to be used with the TryCatchHandler from the
json_api:http
package and provides some meaningful defaults out of the box.
Functions
-
badRequest(
[OutboundErrorDocument? document]) → Response -
created(
OutboundDocument document, String location) → Response -
methodNotAllowed(
[OutboundErrorDocument? document]) → Response -
noContent(
) → Response -
notFound(
[OutboundErrorDocument? document]) → Response -
ok(
OutboundDocument document) → Response -
response(
int statusCode, {OutboundDocument? document}) → Response - JSON:API response
-
tryCatchMiddleware(
Handler handler, {Future< Response> onError(dynamic, StackTrace)?}) → Handler -
An
Handler
wrapper which calls the wrappedhandler
and does the following: -
unacceptable(
[OutboundErrorDocument? document]) → Response -
unsupportedMediaType(
[OutboundErrorDocument? document]) → Response
Exceptions / Errors
- CollectionNotFound
- A collection is not found on the server.
- MethodNotAllowed
- RelationshipNotFound
- A relationship is not found on the server.
- ResourceNotFound
- A resource is not found on the server.
- UnmatchedTarget