liveBook · Manning

Contract

As explained in Rust Servers, Services, and Apps

An API is a defined interface through which software components communicate and request functionality or data.

An API is a defined interface through which software components communicate and request functionality or data. In distributed web applications, backend services expose APIs that frontends call on behalf of users. section 1.1

A web API connects several implementation concerns:

  • HTTP routes receive requests and dispatch them to handler functions. section 6.3
  • Handlers use data models, database-access functions, and persistence structures to manage application data. section 6.3
  • Frontend code constructs HTTP requests, sends parameters, and interprets serialized or deserialized responses. section 9.8
  • Well-designed APIs reduce roundtrips while supporting throughput, response-time, availability, and predictable latency requirements. section 1.2

RESTful web service

A Rust service built with Actix exposes a set of APIs over HTTP using REST. A larger implementation can add tutor-management routes, with corresponding handlers and database-access functions; a frontend can then invoke those APIs and process the responses. section 3.0 section 6.3 section 9.8

Figure 1.1 A simplified distributed systems stack for a social media application

Use the distributed-systems stack diagram to place APIs between application frontends, backend services, and supporting infrastructure. section 1.1

How Rust Servers, Services, and Apps covers it

How deep it goes
Develops APIs from architectural role through REST routes, handlers, data models, persistence, requests, and serialized responses.
Examples
Uses Actix REST services, tutor-management routes, command-line HTTP requests, authentication forms, and create-update-delete operations.
What it assumes
Assumes familiarity with application components while developing routes, handlers, data models, database access, and HTTP communication in context.
What you can do after
Build it from scratch with Actix, expose REST APIs, connect frontend requests, and interpret serialized backend responses.
How it connects
Connects distributed systems, application frontends, backend services, HTTP, REST, routes, handlers, databases, and serialization.

Also explained in

Compare how 44 books explain contract →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Rust Servers, Services, and Apps. The section links point to the parts of the book it draws on.