Skip to content

Instantly share code, notes, and snippets.

@the-vampiire
Created August 5, 2017 02:56
Show Gist options
  • Select an option

  • Save the-vampiire/b44b9738d9cf971175f6e72f06cf54d1 to your computer and use it in GitHub Desktop.

Select an option

Save the-vampiire/b44b9738d9cf971175f6e72f06cf54d1 to your computer and use it in GitHub Desktop.
/update route controller
router.post('/update', (req, res) => {
const respond = require('./tools/respond');
const update = require('./tools/update');
const body = req.body;
const arguments = body.text;
if(tools.verify.slash(body.token)){
if(~arguments.indexOf(' ')){
let response = update.parse(arguments);
if(typeof response === 'string') res.end(response);
else{
// database update the profile item passing the expected data
console.log(response);
}
}else{
if(!arguments) res.send(respond.helpResponse('help'));
if(arguments === 'aptitudes'){
console.log('aptitudes');
res.json(tools.interactive.interaction('update'));
}else res.end(respond.helpResponse(arguments));
}
}else{
res.end('invalid Slack token');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment