{"size": 1352, "ext": "js", "max_stars_repo_path": "lib/routes.js", "max_stars_repo_name": "Zielak/chat", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "lib/routes.js", "max_issues_repo_name": "Zielak/chat", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "lib/routes.js", "max_forks_repo_name": "Zielak/chat", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 19.3142857143, "max_line_length": 62, "alphanum_fraction": 0.5318047337}

function empty(o) {
  for(var i in o) 
    if(o.hasOwnProperty(i))
      return false;

  return true;
}

module.exports.set = function(app, io, users){
  // copy your routes listed in your app.js directly into here
  app.get("/", function(req, res){
    res.render("page");
  });
  
  /*
   * /user
   * Adds new user, requires parameters
   */
  /*app.get("/user", function(req, res){
    var name = req.query.name;
    var reply = {
      status: 'ok',
      text: '',
      name: name
    };
    
    if( !empty(req.query) ){
      
    reply.username = name;
    
    }else{
      reply.status = 'fail';
      reply.status = 'Pusty request';
    }
    
    res.header('Content-Type', 'application/json');
    res.header('Charset', 'utf-8');
    res.json(reply);
  });
  
  * DELETED, we've got authorize
  * */
  
  
  /*
   * /users
   * List connected users and their properties
   */
  app.get("/users", function(req, res){
    var clients = io.sockets.clients();
    var users = [];
    
    for(var i=0; i < clients.length; i++){
      users.push({
        id: clients[i].id,
        storeData: clients[i].store.data
        //name: clients[i].get('name')
      });
    }
    
    var reply = {
      users: users
    };
    
    res.header('Content-Type', 'application/json');
    res.header('Charset', 'utf-8');
    res.json(users);
  })
}