OLD Backend algorithm:

 /*
            SYNC STRATEGY
            =-=-=-=-=-=-=
                        
            NEW ITEMS:
            client record is iterated looking for non id or versioned items meaning newly added.  If any are found the master rev is incremented and new items
            are added.

            DELETED ITEMS:
            Server record is itereated looking for deleted items (not on the client's list and are older revision than the client version), if any are 
            found master rev is incremented (unless it was already) then they are removed from the master list.
            
            UPDATE
            Compare client record to master record, compare list name for a change, then find all items that have the same ID but different user editable values, if any found update master rev
            if not done already, make master changed items match client changed items, update master. 
           
            RETURN:
            Finally, if master list has changed, it is saved to db then it is returned to user otherwise {nochange:1} or something is returned.
        */



NEW ALGORITHM 
Basically the same, except it will sync all lists on the device at once, so the routes need to take a list of lists of listitems as a chunk, not just a single list



OLD ROUTES
=-=-=-=-=-=

//POST - GET AN AUTHENTICATION TOKEN   
router.route('/authenticate')


//GET USERS LISTS
// get all the lists for username specified 
router.route('/mylists')   


//GET A LIST OBJECT
// get the list object for id specified .
router.route('/list/:listid')   


//POST - CREATE / SYNC A LIST    
router.route('/list')


//DELETE - REMOVE A LIST    
router.route('/list')


//DOWNLOAD - download all data
router.route('/mylists/download_all')   


NEW ROUTES
=-=-=-=-=-
Since there is so little data overall in these lists, we are just going to assume all lists on all devices.
A Sync operation just sends the whole graph and gets the whole graph back, it's stored in a single field in sqlite table

If a user doesn't want to see a list maybe it's filtered out at the client view

Authenticate - POST

    
/user - post get 
    Gets and sets the users list subscriptions

/sync
    POST - 
        client posts their entire subscribed list graph at once, 
        the return is the entire user's list graph after synced at server
        new lists are also created via this mechanism (at client first)
        If a client is just getting lists (for example in a first run scenario) they just post an empty list graph
    GET - (no get?  Post an empty list if you want to get all the user's lists)


        

NEW List data object graph:

{

    lists:[
    Name:listname,
    id:ShortIdString,
    name_v:integer,
    v:integer,
    items:[
        id: ShortIdString or empty if new and not assigned an id yet,
        completed: bool,
        text:,
        v:incrementing_long,
        priority:[int 0-3] 
        
    ]
]
}


https://github.com/tastejs/todomvc/blob/gh-pages/examples/jquery/js/app.js
https://github.com/tastejs/todomvc/blob/master/examples/jquery/index.html


