Skip to content
/ resqu Public

WIP. Expose data from a database as a REST API.

License

Notifications You must be signed in to change notification settings

pyrooka/resqu

Repository files navigation

resqu Build Status

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

Usage

Docker

docker run -v $(pwd)/config.yaml:/resqu/config.yaml pyrooka/resqu

If you want to use docker compose check the examples directory.

Helm

helm upgrade -i resqu ./resqu-helm

Environment variables

  • SERVER_PORT
  • CACHE_TYPE: local or redis

DB configs

Templates you can use:

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

SQLite3

sqlite:
  connection:
    path: /db/employees.sqlite3 # path to the DB file
  endpoints: []

PostgreSQL

postgresql:
  connection:
    connectionURL: "postgresql://[user[:password]@][netloc][:port][,...][/dbname][?param1=value1&...]"
  endpoints: []

BigQuery

bigquery:
  connection:
    serviceAccPath: /google/sa.json # path to the service account json
    projectId: my-awesome-project # the project ID for the queries
  endpoints: []

API responses

Status code Body
200 {"data": [...]}
400 error message
500 error message

About

WIP. Expose data from a database as a REST API.

Resources

License

Stars

Watchers

Forks