examples/programmatic-route.js
function (rep, next) {
                    rep.entity.items.forEach(function (item) {
                        var embed = rep.embed('item', './' + item.id, item);
                        if (item.googlePlusId) {
                            embed.link('home', 'http://plus.google.com/' + item.googlePlusId);
                            embed.ignore('googlePlusId');
                        }
                    });
                    rep.ignore('items');
                    // dont forget to call next!
                    next();
                }
function (rep, next) {
                    rep.entity.items.forEach(function (item) {
                        var embed = rep.embed('item', './' + item.id, item);
                        if (item.googlePlusId) {
                            embed.link('home', 'http://plus.google.com/' + item.googlePlusId);
                            embed.ignore('googlePlusId');
                        }
                    });
                    rep.ignore('items');
                    // dont forget to call next!
                    next();
                }
function ( rep , next ) { rep . entity . items . forEach ( function ( item ) { var embed = rep . embed ( 'item' , './' + item . id , item ) ; if ( item . googlePlusId ) { embed . link ( 'home' , 'http://plus.google.com/' + item . googlePlusId ) ; embed . ignore ( 'googlePlusId' ) ; } } ) ; rep . ignore ( 'items' ) ; // dont forget to call next! next ( ) ; }
you can also assign this function directly to the hal property above as a shortcut
you can also assign this function directly to the hal property above as a shortcut