1.0.8 • Published 7 years ago

postrestql v1.0.8

Weekly downloads
2
License
ISC
Repository
github
Last release
7 years ago

PostRESTql

PostRESTql is a node server that automatically creates RESTful web services from a connected PostgreSQL database. If also provides a simple way to quickly create custom web services using more complex queries.

Installation

npm install postrestql

Basic Use

The simplest setup looks like this:

var postrestql = require("postrestql");

var config = {
    "db_connections": {
        "admin": "postgres://username:password@server:5432/catalog"
    }
};

postrestql.start(config);

If the admin connection string points to a user on a running PostgreSQL server with sufficient privileges, a web service will be created on port :4100 that will list all tables as HTML pages.

Configuration Reference

var config = {
    "db_connections": {
        "admin": "postgres://chrisbroski:@localhost:5432/utilities",
        "web_user": "postgres://chrisbroski:@localhost:5432/utilities"
    },
    "port": 4100,
    "cors": true,
    "sql_folder": "./sql"
    "custom": [
        {
            "name": "totals by month",
            "path": "/month-totals/{{integer}}/{{integer}}",
            "sql_statement": "get_month_totals"
        },
        {
            "name": "totals by month",
            "path": "/month-totals/{{integer}}/{{integer}}",
            "sql": "get_month_totals",
            "default": [2017, 1]
        }
    ]
};
1.0.8

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago