PostgREST: The most important technology you've never used
The most unknown and underrated technology I’ve ever used is certainly PostgREST.
What is PostgREST, and what does it do for you?
Your Postgres table definitions/schema/etc => PostgREST => RESTful API.
That’s right. You define a Postgres table like
CREATE TABLE users (
user_id serial NOT NULL UNIQUE PRIMARY KEY,
username text NOT NULL
);
and then start the postgrest
binary with the default config, and now all you have to do to create a new user is
$ curl -X POST -H “Content-Type: application/json” -d ‘{“username”:”elimisteve”}’ localhost:3000/users
And then to fetch this user
row, all you need to do is
$ curl localhost:3000/users?username=eq.elimisteve
I will never write simple CRUD logic ever again in any language – Python, Ruby, Go, JavaScript, etc.
((TODO: Say more.))
To learn more, see the API docs at <https://postgrest.com/en/v0.4/api.html>
The future will be auto-generated.