Re: question about HTTP API - Mailing list pgsql-hackers

From Andrew Tipton
Subject Re: question about HTTP API
Date
Msg-id CA+M2pVX4CnvCdHmQzPP1OeNwgP956_sp-6jw2xe-P0QNe-vKAw@mail.gmail.com
Whole thread Raw
In response to Re: question about HTTP API  (Josh Berkus <josh@agliodbs.com>)
List pgsql-hackers
On Fri, Aug 9, 2013 at 3:44 AM, Josh Berkus <josh@agliodbs.com> wrote:
Well, there's HTSQL: http://htsql.org/

Other than that, no.  I was thinking of creating a general tool as a
custom background worker, which would take stored procedure calls and
pass them through to PostgreSQL, returning results as JSON.  Mainly
because I need it for a project.  However, this wouldn't accept any query.

I'm actually in the process of writing an HTTP server that lives inside Postgres.  I hope to have a WIP patch ready in the next week or two, and then (if all goes well) submit it for CF2.  [There are a few impediments to doing this as an extension module, which I shall detail as part of the WIP patch...]

Why integrate a webserver with Postgres?  Well, the trend that we're seeing in web development is to push much of the display logic into client-side Javascript frameworks and expose the database through an HTTP API.  (Good examples of this are Parse and Meteor.)  CouchDB can even host the application's static content alongside the data.   As a result, many applications don't need any middle-tier Python/Ruby/Java framework at all.

One of my goals is to allow Postgres to directly serve HTTP requests and return arbitrary content (e.g. text/html in addition to JSON) directly to end-user browsers.  With the JSON datatype and PL/v8, code can even be re-used on both client and server.  Getting rid of an entire middle tier would make small-scale application development dramatically easier.


Regards,
Andrew Tipton

pgsql-hackers by date:

Previous
From: Andrew Tipton
Date:
Subject: Re: question about HTTP API
Next
From: Greg Stark
Date:
Subject: Re: question about HTTP API