forked from ccoenraets/slackforce
-
Notifications
You must be signed in to change notification settings - Fork 1
/
server.js
36 lines (28 loc) · 1.15 KB
/
server.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
"use strict";
let express = require('express'),
bodyParser = require('body-parser'),
auth = require('./modules/slack-salesforce-auth'),
contact = require('./modules/contact'),
account = require('./modules/account'),
opportunity = require('./modules/opportunity'),
_case = require('./modules/case'),
whoami = require('./modules/whoami'),
actions = require('./modules/actions'),
app = express();
app.enable('trust proxy');
app.set('port', process.env.PORT || 5000);
app.use('/', express.static(__dirname + '/www')); // serving company logos after successful authentication
app.use(bodyParser.urlencoded({extended: true}));
app.post('/actions', actions.handle);
app.post('/pipeline', opportunity.execute);
app.post('/contact', contact.execute);
app.post('/account', account.execute);
app.post('/case', _case.execute);
app.post('/whoami', whoami.execute);
app.post('/login', auth.loginLink);
app.post('/logout', auth.logout);
app.get('/login/:slackUserId', auth.oauthLogin);
app.get('/oauthcallback', auth.oauthCallback);
app.listen(app.get('port'), function () {
console.log('Express server listening on port ' + app.get('port'));
});