PostgREST Backend RESTAPI auto-gen

Launch PostgREST with docker and generate backend API automatically.

PostgREST - 图1

This is an example of creating pigsty cmdb API with PostgREST

  1. cd ~/pigsty/app/postgrest ; docker-compose up -d

http://10.10.10.10:8884 is the default endpoint for PostgREST

http://10.10.10.10:8883 is the default api docs for PostgREST

  1. make up # pull up postgrest with docker-compose
  2. make run # launch postgrest with docker
  3. make ui # run swagger ui container
  4. make view # print postgrest access point
  5. make log # tail -f postgrest logs
  6. make info # introspect postgrest with jq
  7. make stop # stop postgrest container
  8. make clean # remove postgrest container
  9. make rmui # remove swagger ui container
  10. make pull # pull latest postgrest image
  11. make rmi # remove postgrest image
  12. make save # save postgrest image to /tmp/postgrest.tgz
  13. make load # load postgrest image from /tmp

Swagger UI

Launch a swagger OpenAPI UI and visualize PostgREST API on 8883 with:

  1. docker run --init --name postgrest --name swagger -p 8883:8080 -e API_URL=http://10.10.10.10:8884 swaggerapi/swagger-ui
  2. # docker run -d -e API_URL=http://10.10.10.10:8884 -p 8883:8080 swaggerapi/swagger-editor # swagger editor

Check http://10.10.10.10:8883/

Last modified 2022-06-03: add scaffold for en docs (6a6eded)