Kannaj / 42EXP

Find teams to work together with on projects
https://42exp.com/
Other
21 stars 7 forks source link

Make sockethandlers api consistent #7

Open Kannaj opened 8 years ago

Kannaj commented 8 years ago

There are a few socket handlers like the below

socket.on('project:check_name',project_check_name)

project_check_name being a function which invokes pg-promise

And a few like the below

    socket.on('project:join',function(data,res){
      data.username = socket.getAuthToken().username
      join_project(data)
        .then(function(result){
          res(null,result)
        })
        .catch(function(err){
          winston.error('User cant join project : ',err)
          res('Cant join project')
        })
    })

The second one is more consistent and allows for easier testing. Make all apis consistent