/
Server.js
44 lines (32 loc) · 1.17 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
37
38
39
40
41
42
43
44
var express = require('express'),
http = require('http'),
request = require('request'),
bodyParser = require('body-parser'),
app = express();
var logFmt = require("logfmt");
app.use(express.static(__dirname + '/client'));
app.use(bodyParser.json());
app.set('port', process.env.PORT || 3000);
app.all('/proxy', function(req, res) {
var url = req.header('SalesforceProxy-Endpoint');
request({ url: url, method: req.method, json: req.body,
headers: {'Authorization': req.header('X-Authorization'), 'Content-Type' : 'application/json'}, body:req.body }).pipe(res);
});
app.get('/' , function(req,res) {
res.sendfile('views/index.html');
} );
app.get('/index.html' , function(req,res) {
res.sendfile('views/index.html');
} );
app.get('/index*' , function(req,res) {
res.sendfile('views/index.html');
} );
app.get('/oauthcallback.html' , function(req,res) {
res.sendfile('views/oauthcallback.html');
} );
app.get('/Main*' , function(req,res) {
res.sendfile('views/Main.html');
} );
app.listen(app.get('port'), function () {
console.log('Express server listening on port ' + app.get('port'));
});