0.8.0 • Published 1 year ago

@tolokoban/api v0.8.0

Weekly downloads
-
License
GPL-3.0
Repository
github
Last release
1 year ago

@tolokoban/api

Quick Typescript code generator for simple and robust RPC applications based on a subset of REST protocol.

Usage

Install it like this:

npm install --save-dev @tolokoban/api

Start it like this:

npx api config.json5

If you need help in creating an initial configuration file, just type:

npx api --init

Usecase

See this short video where we show an example of a very simple math application.

https://user-images.githubusercontent.com/3356894/207921623-f5ab8a38-588d-4347-8caa-ddb46e2870aa.mp4

You can see that implementing an entrypoint is quite easy and Typescript gives a lot of autocompletion out of the box.

Motivation

When creating a RPC client/server application, we want to focus on the precise definition of the server's API: the list of all the entry points.

All the boilerplate to exchange messages with format checking, error handling and authentication is cumbersome and error prone.

What do we mean by subset of REST?

Internally, we use REST to communicate between the client and the server. Here is how we use it, but you don't really need to know this since @tolokoban/api does all the abstraction for you.

  • We use only POST queries.
  • All the messages have the type application/json.
  • HTTP status are used like this:
    • 200: The query succedeed.
    • 400: The format of the params received by the server don't match definition.
    • 401: Authentication failed.
    • 500: The procedure has been executed but returned an error.
  • We use token authentication in the header.
0.8.0

1 year ago

0.7.3

1 year ago

0.7.0

1 year ago

0.6.0

1 year ago

0.5.0

1 year ago

0.3.0

1 year ago

0.2.0

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago