Re:PgREST: Node.js in the Database, compatible with MongoLab...
by audreyt on Friday November 29, 2013 @10:10AM
(#6819632)
Excellent question! The REST API part should be familiar to any Rails programmer.
The main difference is that back-end models, validation rules, triggers and views are coded in DB level via stored procedures written in Node.js-compatible modules, so it's enforced for both SQL- and HTTP-speaking clients.
As you pointed out, this is simply an instant JSON-over-REST API server on top of existing Pg databases, and is not intended to replace the need for traditional frameworks with server-side templating.
Re:PgREST: Node.js in the Database, compatible with MongoLab...
by JonnieCache on Friday November 29, 2013 @10:16AM
(#6819657)
Ah, so I guess I could stop avoiding traditional SQL features like triggers for fear of having code floating around outside my main app codebase, and it would generally make everything more centralised. I wouldn't have to worry about my workers having access to the correct model code and so on. Interesting.
EDIT: how easy do you think it would be to do the authentication etc outside, at the level of the nginx proxy?
Re:PgREST: Node.js in the Database, compatible with MongoLab...
by audreyt on Friday November 29, 2013 @10:51AM
(#6819811)
For authentication (authn) it's quite easy, and in production we do have a separate authn daemon.
For authorization (authz) it's IMHO a bit better to handle it in the DB level, similar with Firebase's ACL lists.
EDIT: I did some research: there is no difference. It's just plain ol' rails-style REST. This project is basically taking your thin sinatra/express/flask API layer and pushing it into the database itself, for reasons I am as yet unable to ascertain.