0.7.2 • Published 9 years ago

backbone-http v0.7.2

Weekly downloads
2
License
MIT
Repository
github
Last release
9 years ago

Build Status

logo

BackboneHTTP provides an HTTP interface that can be used in the browser or from Node.js.

This allows for a iteration of remote collections from the browser using BackboneORM's unified query syntax and iteration methods.

Examples (CoffeeScript)

class Project extends Backbone.Model
  urlRoot: '/projects'
  sync: require('backbone-http').sync(Project)

# Find all items with is_active = true
Project.find {is_active: true}, (err, projects) ->

# Iterate through all items with is_active = true in batches of 200
Project.each {is_active: true, $each: {fetch: 200}},
  ((project, callback) -> ),
  (err) -> console.log 'Done'

# Stream all items with is_active = true in batches of 200
Project.stream({is_active: true, $each: {fetch: 200}})
  .pipe(new ModelStringifier())
  .on('finish', -> console.log 'Done')

Examples (JavaScript)

var Project = Backbone.Model.extend({
  urlRoot: '/projects'
});
Project.prototype.sync = require('backbone-http').sync(Project);

// Find all items with is_active = true
Project.find({is_active: true}, function(err, projects) {});

// Iterate through all items with is_active = true in batches of 200
Project.each({is_active: true, $each: {fetch: 200}},
  function(project, callback) {},
  function(err) {return console.log('Done');}
);

// Stream all items with is_active = true in batches of 200
Project.stream({is_active: true, $each: {fetch: 200}})
  .pipe(new ModelStringifier())
  .on('finish', function() {return console.log('Done');});

Please checkout the website for installation instructions, examples, documentation, and community!

For Contributors

To build the library for Node.js and browsers:

$ gulp build

Please run tests before submitting a pull request:

$ gulp test --quick

and eventually all tests:

$ npm test
0.7.2

9 years ago

0.7.1

10 years ago

0.7.0

10 years ago

0.6.2

10 years ago

0.6.0

10 years ago

0.5.6

10 years ago

0.5.5

10 years ago

0.5.4

10 years ago

0.5.3

10 years ago

0.5.2

10 years ago

0.5.1

11 years ago

0.5.0

11 years ago

0.0.0

11 years ago