old_contents: 'use strict';
  
  var mean = require('meanio');
  
  module.exports = function(System, app, auth, database) {
  
      app.route('/admin/menu/:name')
          .get(function(req, res) {
              var roles = (req.user ? req.user.roles : ['anonymous']);
              var menu = req.params.name ? req.params.name : 'main';
              var defaultMenu = (req.query.defaultMenu ? req.query.defaultMenu : []);
  
              defaultMenu.forEach(function(item, index) {
                  defaultMenu[index] = JSON.parse(item);
              });
  
              var items = mean.menus.get({
                  roles: roles,
                  menu: menu,
                  defaultMenu: defaultMenu
              });
  
              res.json(items);
          });
  
  };
  
new_contents: 'use strict';
  
  var mean = require('meanio');
  
  module.exports = function(System, app, auth, database) {
  
      app.route('/admin/menu/:name')
          .get(function(req, res) {
              var roles = req.user ? req.user.roles : ['anonymous'];
              var menu = req.params.name || 'main';
              var defaultMenu = req.query.defaultMenu || [];
  
              if (!Array.isArray(defaultMenu)) defaultMenu = [defaultMenu];
  
              var items = mean.menus.get({
                  roles: roles,
                  menu: menu,
                  defaultMenu: defaultMenu.map(function(item) {
                      return JSON.parse(item);
                  })
              });
  
              res.json(items);
          });
  };
  
subject: fix #605 allow for single menu object instead of array