GithubHelp home page GithubHelp logo

isabella232 / mongosync Goto Github PK

View Code? Open in Web Editor NEW

This project forked from condenast/mongosync

0.0 0.0 0.0 192 KB

A Backbone.Sync replacement for persisting data on the backend using MongoJS

License: MIT License

JavaScript 100.00%

mongosync's Introduction

Build Status

MongoSync

A drop-in Backbone.Sync replacement for persisting data on the backend.

More info

Installing

npm install mongosync

or

bower install mongosync

Interface

MongoSync returns a function which then returns a context-aware Backbone model. It's wrapped in a function so that the sync method can be given the correct db location and collection to use.

Using with RequireJS

It will detect if you're in an AMD situation and provide the appropriate define for RequireJS. You will also need amdefine in your project.

Example:

if(typeof define !== 'function'){
    define = require('amdefine')(module);
}

define(function(require){
    var SharedModel = require('mongosync')('localhost', 'test');

    var MyModel = SharedModel.extend({});

    return MyModel;
});

Using in CommonJS (including Browserify)

var SharedModel = require('mongosync')('localhost', 'test');

var MyModel = SharedModel.extend({});

module.exports = MyModel;

Browser Global (not recommended)

<!-- script tags for backbone and underscore appear here -->
<script src="bower_components/mongosync/mongosync.js"></script>

Then in your code:

var MyModel = SharedModel().extend({});

Development

To install the dependencies:

npm install

Uses grunt to handle development tasks. All grunt tasks are available via npm run using a locally installed copy of grunt-cli.

Testing

npm test to run unit tests.

You will need a mongodb server running somewhere to run the tests...

License

MongoSync is provided under the terms of the MIT License

mongosync's People

Contributors

toddself avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.