postgrest is an outdoor web server that allows you to turn any database stored in POSTGRESQL DBMS, full-fledged RESTful API. Motivation to writing Postgrest was the desire to go away from manual programming crud , as this can lead to problems: writing business logic often duplicates , ignores or complicates the structure of the database; Object-relational display (ORM Mapping) is not reliable abstraction, which leads to a slow imperative code and can be causal safety problems. Postgrest is written in Haskell and extends under license Mit.
Postgrest philosophy in declarative data, without unnecessary sucks. Postgrest does not use ORM, all views are created directly in the database. To create and support a backend API with Postgrest is enough to have in the administrator of the DBMS. Postgrest simplifies the development of the backend and allows you to combine, extract and filter data through the query. Instead of writing code in controllers (Controllers), you can simply assign permissions for objects in the database, and instead of writing numerous checks, you can directly set the limitations in the database.
Several illustrations of POSTGREST features:
CURL http: // Localhost: 3000 / TODOS [{“ID”: 1, “Done”: false, “Task”: “finish tutorial 0”, “due”: null}, {“ID”: 2, “DONE”: FALSE, “TASK”: “PAT SELF ON BACK”, “DUE”: NULL}] CURL http: // LocalHost: 3000 / Todos -x Post \ – H “Content-Type: Application / JSON” \ -D ‘{“Task”: “Do Bad Thing”}’ {“Hint”: NULL, “Details”: NULL, “Code”: “42501”, “Message “:” PERMISSION DENIED FOR RELATION TODOS “} Get / Films? Select = Title, Directors (id, last_name) http / 1.1 [{” title “:” Workers Leaving The Lumière Factory In Lyon “,” Directors “: {” ID “: 2,” Last_Name “:” Lumière “}}, {” Title “:” The Dickson Experimental Sound Film “,” Directors “: {ID”: 1, “Last_Name”: “Dickson”}}, {” Title “:” The Haunted Castle “,” Directors “: {” ID “: 3,” Last_Name “:” méliès “}}]
For Postgrest there are client libraries and extensions, including OATH, Websockets, Amazon Kinesis. Also available Starter-Kit , which works in Docker and includes Postgrest, OpenResty web server on Lua, PGTAP, Rabbitmq and control panel.
You can start the application on Postgrest on the platform Heroku , as well as using Docker. There is also a profile cloud platform with advanced features, Subzero , the developers of which are developing fork postgrest + , in which aggregate and window functions are implemented, as well as reading replication.