technology from back to front

Posts Tagged ‘AngularJS Meteor Meteorite Postgres Collections’

Live updates to Meteor from Postgres

[Extra form validation angular-ui]: http://angular-ui.github.com/
[AngularJS]: http://angularjs.org/
[Meteor]: http://meteor.com/
[Node.js]: http://nodejs.org/
[Postgres]: http://www.postgresql.org/
[TimeTracker]: http://www.lshift.net/timetracker.html
[Meteorite]: https://github.com/oortcloud/meteorite
[Meteor Postgres]: http://stackoverflow.com/questions/10802191/using-meteor-with-postgresql
[Node.js pg]: http://gurjeet-tech.blogspot.co.uk/2012/11/install-pg-nodejs-module-node-postgres.html
[Postgres Node.js LISTEN NOTIFY]: http://bjorngylling.com/2011-04-13/postgres-listen-notify-with-node-js.html
[pg Standalone Client]: http://lheurt.blogspot.co.uk/2011/11/listen-to-postgresql-inserts-with.html
[Meteor Fibers]: http://stackoverflow.com/questions/10192938/meteor-code-must-always-run-within-a-fiber-when-calling-collection-insert-on-s
[Fiber]: http://en.wikipedia.org/wiki/Fiber_(computer_science)
[Node Fibers]: https://github.com/laverdet/node-fibers
[Node Postgres]: https://github.com/brianc/node-postgres
[Meteor-AngularJS]: https://github.com/lvbreda/Meteor_angularjs
[Meteor Angular Leaderboard demo]: https://github.com/bevanhunt/meteor-angular-leaderboard
[Meteor Principles]: http://docs.meteor.com/#sevenprinciples
[NOTIFY]: http://www.postgresql.org/docs/9.0/static/sql-notify.html
[LISTEN]: http://www.postgresql.org/docs/9.0/static/sql-listen.html
[js2coffee]: http://js2coffee.org/

I’ve been playing around with [Meteor][] recently for an internal LShift project in which I wanted the browser to have a read-only live view onto some timetracking data from [TimeTracker][] as it changes. When a developer records time spent on a particular task, a row is inserted into a [Postgres][] database. Simples.

One of Meteor’s selling points is its transparent client-server data synchronisation through its powerful `Collections` API, which is backed by MongoDB on the server side. This poses a potential challenge for us: how can we leverage the reactive `Collection`s of Meteor yet feed it with Postgres data?

Well, I did manage to wrestle my fork of Bevan Hunt’s (a Meteor contributor!) excellent [Meteor Angular Leaderboard demo][] into live page update as database insertions occur on Postgres. You could extend this to deal with database updates and deletions as well, an exercise left for the willing.

Read more…

by
hok
on
25/02/13

Search

Categories

Feeds

Archives

2000-14 LShift Ltd, 1st Floor, Hoxton Point, 6 Rufus Street, London, N1 6PE, UK+44 (0)20 7729 7060   Contact us