Skip to content

nathancahill/now-postgrest

Repository files navigation

now-postgrest

Deploy PostgREST to Now.

now.json
{
    "functions": {
        "api/postgrest.conf": {
            "runtime": "now-postgrest@0.3.0"
        }
    },
    "routes": [
        { "src": "api/rpc/.*", "dest": "api/postgrest.conf" },
        { "src": "api/(films|actors)", "dest": "api/postgrest.conf" }
    ],
    "env": {
        "DB_URI": "@secret-db-uri"
    }
}
api/postgrest.conf
db-uri = "$(DB_URI)"
db-schema = "api"
db-anon-role = "web_anon"
base-url = "/api/"

Locally with now dev

A local postgrest binary is required to be in your $PATH. Follow the installation instructions.

.env
DB_URI=postgres:///app