JSDBI 0.01-beta December 3
I’m finally finished packaging up JSDBI for public consumption. It’s not too fancy yet, but the basic functionality is there. Download the code here
JSDBI provides an easy to setup CRUD interface for REST web services. With a few lines of javascript, you can build a class which provides full fledged accessor code, very similar to Class::DBI. Only this is on the browser, in javascript.
Here’s how it looks from an end user perspective:
// Basic class setup
Music.Artist = Class.create();
Music.Artist.extend(JSDBI);
Music.Artist.prototype = (new JSDBI()).extend( {
initialize: function () {
},
});
Music.Artist.fields(['artistid', 'name']);
Music.Artist.url('http://someserver/rest/artist');
Music.Artist.elementTag('artist'); //optional
// In the calling code
var artist = Music.Artist.insert({name: 'Billy'});
var artistid = artist.id();
artist = Music.Artist.retrieve(artistid);
document.write("name: "+artist.name());
artist.name('Fred');
artist.update();
artist.destroy();
Feel free to download it, beat it up, tell me what’s missing, whatever.