Skip to content

plus3network/backbone-mysql

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

backbone-mysql

A sync module for Backbone.js and Node.js for use with MySQL. The motivation behind this module is that most of the ORM's for Node.js are kind of crappy. They either have bugs which make them unusable or they impliment a promises interace that is not to my liking. I was also looking for something that would work mostly the same on the frontend as the backend so that our developers can learn just one framework.

Getting Started

Install the module with: npm install backbone-mysql

var Backbone = require('backbone-mysql');
var mysql = require('mysql');
Backbone.client = mysql.createClient();

var MyModel = Backbone.Model.extend({
  urlRoot: '/users'
});

var example = new MyModel({ id: 1 });
example.fetch({
  success: function (model, response, options) {
    model.save({ name: 'Foo' }, {
      success: function (model, response, options) {
        // Do somthing awesome here.
      }
    });
  }
});

Since the promises/callback pattern for Backbone is not very Node.js-ish I would recommend using https://npmjs.org/package/backbone-callbacks to make things feel more native.

Documentation

(Coming soon)

Examples

(Coming soon)

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using grunt.

Release History

v0.1.0 Inital Development Release

License

Copyright (c) 2012 Chris Cowan
Licensed under the MIT license.

About

A sync module for Backbone.js and Node.js for use with MySQL

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages