Created
August 5, 2017 02:56
-
-
Save the-vampiire/b44b9738d9cf971175f6e72f06cf54d1 to your computer and use it in GitHub Desktop.
/update route controller
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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