I did something similar once, but integrated everything RESTful into nginx which connected to postgres directly, which ran triggers with JS. What I didnt like about it is being bound by max connections to postgres, and then blocking postgres thread when running javascript in it. The parallelization story just wasnt competitive enough.
Is this something that omnigres addresses?