Expose a ToDo model over the network.
var Server = require'todo-server';var Doc = require'crdt'Doc;// Start a server on port 9999Server'/tmp/db'listen9999;var doc = ;var docStream = doccreateStream;var Model = require'todo-model'doc;// replicate the local doc with the serverdocStreampipenetconnect9999pipedocStream;console.logModelTasksfind;// outputs all the tasks stored in the db
Create a new Server that stores its data in a
(err, doc) where
doc is the underlying
Don't forget to call
doc.dispose() when you're done.
Start listening on
port. Returns a
Shut down and free the underlying LevelDB.
$ todo-serverUsage: todo-server --port [port] --db [path]Options:--port, -p Port to listen on [required]--db, -d Path of the database [required]
With npm do
$ npm install todo-server # for library$ npm install todo-server -g # for cil
Copyright (c) 2013 Julian Gruber <firstname.lastname@example.org>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.