MarsDB DDP Server
It's a Meteor compatible DDP server, based on MarsDB, but with major improvements. It supports methods, pub/sub and collection operations. It have very similar to the original Meteor interface, so, you really knows how to use it, if you are familiar with Meteor. But it also highly customizable, because it can be used with any server, that you passed to a configure
function. Check out a basic example with express and webpack.
Features
- Asynchonous server – no Fibers
- Reactive joins in publish – out of the box
- Framework agnostic – configured upon node.js's http server
- Easy to test and play – no MongoDB needed, MarsDB works with memory by default
WARNING
It's only a concept until 1.0. Use it for your own risk. It does not support scaling, handled only changes happened on one instance. Scaling will be handled by MarsDB-Mongo module.
Examples
Basic Express/Webpack example
The repository comes with a simple example. To try it out:
git clone https://github.com/c58/marsdb-sync-server.git
cd marsdb-sync-server/example && npm install
npm start
Then, just point your browser at http://localhost:3000
.
Configure a server
;;; // Some server configuration// ...const server = http; // Setup marsdb-sync-serverMarsSync; // You must require all your models, publishers and methods.// They will be registered in MarsSync server.;;;
Auto-publish
// ...// Setup marsdb-sync-server with autoPublish enabledMarsSync; // With {autoPublish: true} all documents in each// collection will be sent to each newly connected client
Publising
;;; // Publish all todos in a collection and all users,// who have created todos;
Methods
; // Defines a method named 'seyHello';
Using with MongoDB (and other storages)
By default MarsDB uses memory to store collections. You can easily configure it for using MongoDB (or other storages) as a backend. Just configure MarsDB to use MongoDB before any instance of a Collection class created
// server.js;// DO NOT import Colllection releted modules here// ...other imports // ...some server configurationMarsMongo;MarsSync; // Require all Collection releted modules;;;
Roadmap
- Context customization by other modules
- Documentation
Contributing
I'm waiting for your pull requests and issues.
Don't forget to execute gulp lint
before requesting. Accepted only requests without errors.
License
See License