Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

Slow Reader API

Types, validation RegExp, and constants shared between clients and server.

Subprotocol Version

“Subprotocol” is a client-server API: Logux actions, HTTP URL schema and HTTP request/response types.

The term has “sub” because it is inside Logux sync protocol.

Every time we have client-server API changes, we need to update subprotocol version to be able to handle old clients. For instance, mobile app could take months for update.

Server can ask user to update client app if version is too old. Or we can add different handler for old clients.

Logux Actions

We define Logux actions types and action creators here to be sure, that client and server have the same types.

HTTP API

For every HTTP endpoint we define here:

  • URL params and HTTP request & response body types.
  • fetch() wrapper with types to use in client.
  • Endpoint definition with URL parse & request validation to use in server helper and provide types.

It allows us to verify that client and server API is compatible.

Validators

To have the same validation on the client and on the server, we share RexExps.