RESTful as a Cloud Service

PostgreSql

PostgREST

PostgREST

PostgREST serves a full RESTful API from any existing PostgreSQL database type. According to the development team, PostgREST offers a cleaner API that meets standards and is faster than the one you can write from scratch. Considers that its use is an alternative to manual CRUD programming. PostgREST is an open source middleware, and the APIs exposed by PostgREST comply with the OpenAPI specification (formerly known as the Swagger specification).


According to its documentation, it natively manages the dependencies between database tables, which allows you with a simple REST request to retrieve data from a join between two tables. PostgREST would be very fast, with a response time of less than one second for up to 2000 requests / second.


Three factors contribute to this speed depending on the team. First, the server is written to Haskell using the HTTP Warp (lightweight compiled language) server. It then delegates as many calculations as possible to the database, including serializing JSON responses directly into SQL, validating data, and so on. Finally, it uses the Hasql library to maintain a number of database connections, the PostgreSQL binary protocol, and remains stateless to allow horizontal scaling.


PostgREST manages authentication (via JSON Web tokens) and delegates the authorization of role information defined in the database. This ensures that there is only one declarative source of truth for security. By processing the database, the server assumes the identity of the currently authenticated user, and during the connection it cannot do anything that the user himself could not do. Other forms of authentication can be built on the JWT primitive. You can get more information in the documentation.

There are no posts to list in this category.