This repo is no real tutorial just to remember the initialisation process for my own configs. If you are totally new to postgREST it might help.
PostgREST Doku: https://postgrest.com/en/v0.4/admin.html
-
Download bin or build or homebrew postgREST
-
Put bin in $PATH or run locally with
./progrest [args]
-
Run postgresDB in a container (not recommended for production)
docker run --name postgres -e POSTGRES_PASSWORD=pw -e POSTGRES_DB=tutorial -d -p 5432:5432 postgres
-
Start postgREST -> Should run on http://localhost:3000/ but you should have no access
./postgrest sample.conf
-
Create a User anonymous in the DB
-
start swaggerUI
docker run -p 80:8080 swaggerapi/swagger-ui
-
go to http://localhost/ an insert http://localhost:3000/ in swagger to load SwaggerConfig
The empty database is now running and exposing the public schema to the anonymous user.
-
Create a sample table with anonymous access for our blog
psql -f db/01_init_post.sql --host=localhost --port=5432 --username=postgres
-
Create the Role anonymous & Grant anonymous access to our table
psql -f db/02_init_anonymous.sql --host=localhost --port=5432 --username=postgres
-
All done. you should be able to GET,POST,UPDATE,PATCH on localhost:3000/posts now
Follow the steps on the docs here
wget "https://github.com/begriffs/postgrest/releases/download/v0.4.1.0/postgrest-0.4.1.0-ubuntu.tar.xz"
tar xf "postgrest-0.4.1.0-ubuntu.tar.xz"