resqu (RESt from QUeries) helps you to serve database query results as JSON via HTTP.
NOTE: the project is under development, so some breaking changes may happen
docker run -v $(pwd)/config.yaml:/resqu/config.yaml pyrooka/resqu
If you want to use docker compose check the examples directory.
helm upgrade -i resqu ./resqu-helm
SERVER_PORT
CACHE_TYPE
: local or redis
Templates you can use:
url
: gorilla/muxquery
: go text/template
E.g. config.yaml
:
sqlite:
connection:
path: /db/employees.sqlite3
endpoints:
- url: /employees
query: SELECT * FROM emp {{if .limit}} LIMIT {{.limit}} {{end}} {{if .offset}} OFFSET {{.offset}} {{end}}
cache:
enabled: true
clearTime: "0 */10 * * * *" # Clear the cache for this URL in every 10 mins. https://github.com/robfig/cron
- url: /employees/{empNo}
query: SELECT * FROM emp WHERE empno = {{.empNo}}
cache:
enabled: false
sqlite:
connection:
path: /db/employees.sqlite3 # path to the DB file
endpoints: []
postgresql:
connection:
connectionURL: "postgresql://[user[:password]@][netloc][:port][,...][/dbname][?param1=value1&...]"
endpoints: []
bigquery:
connection:
serviceAccPath: /google/sa.json # path to the service account json
projectId: my-awesome-project # the project ID for the queries
endpoints: []
Status code | Body |
---|---|
200 | {"data": [...]} |
400 | error message |
500 | error message |