Skip to main content

Crate lino_rest_api

Crate lino_rest_api 

Source
Expand description

A REST API framework and client that speak Links Notation instead of JSON.

Everything the HTTP standards expect of a REST service — content negotiation, conditional requests, problem details, collection pagination, automatic HEAD/OPTIONS/405, CORS, a service description and an OpenAPI document — is provided out of the box, with LINO as the default wire format and JSON as a fallback. The wire protocol is defined in docs/spec/README.md, and the JavaScript, Python and Rust packages speak it byte for byte alike, so the three implementations produce the same entity tags.

Re-exports§

pub use app::DESCRIPTION_PATH;
pub use app::LinoApp;
pub use app::OPENAPI_PATH;
pub use app::RawRequest;
pub use app::create_lino_app;
pub use client::LinoClient;
pub use client::LinoClientError;
pub use client::LinoResponse;
pub use client::RequestOptions;
pub use client::create_lino_client;
pub use codec::decode;
pub use codec::decode_from;
pub use codec::decode_single_line;
pub use codec::encode;
pub use codec::encode_compact_notation;
pub use codec::encode_for;
pub use codec::encode_single_line;
pub use cors::CorsPolicy;
pub use description::ServiceInfo;
pub use media_type::JSON_CONTENT_TYPE;
pub use media_type::LINO_COMPACT_CONTENT_TYPE;
pub use media_type::LINO_CONTENT_TYPE;
pub use media_type::LINO_LINE_CONTENT_TYPE;
pub use middleware::ResponseParts;
pub use problem::LinoHttpError;
pub use request::LinoRequest;
pub use resource::ResourceOptions;
pub use response::LinoResult;
pub use response::accepted;
pub use response::created;
pub use response::no_content;
pub use response::ok;
pub use response::raw_response;
pub use response::status;
pub use serve::BoundServer;
pub use serve::serve;
pub use store::MemoryStore;
pub use store::Store;
pub use value::array;
pub use value::boolean;
pub use value::int;
pub use value::object;
pub use value::string;

Modules§

app
The Links Notation REST API application.
client
Links Notation REST client (specification section 10).
codec
Codec layer: every conversion between a [LinoValue] and the wire.
collection
Collection envelope, in-memory query execution and RFC 8288 link headers (specification section 6).
cors
Cross-origin resource sharing (specification section 8).
description
Machine-readable service description (specification section 9).
etag
Entity tags and conditional requests (specification section 7).
headers
A small, case-insensitive header map that keeps insertion order.
media_type
Media types and content negotiation (specification section 2).
middleware
The request and response halves of the specification, expressed as plain functions: body decoding and content negotiation (section 2.1), entity tags (section 7) and problem details (section 5).
problem
RFC 9457 problem details, expressed in Links Notation (specification section 5).
query
Collection query parsing (specification sections 6.2 - 6.4).
request
The request object handlers receive.
resource
CRUD resource registration.
response
Explicit response values.
router
Route registry backing automatic HEAD, automatic OPTIONS, 405 Method Not Allowed and the service description (specification sections 4.1 and 9).
serve
Running an application over HTTP.
store
The store interface a resource is built on, and an in-memory implementation.
value
Helpers for building and reading [LinoValue] objects.