forked from SargoDarya/bungie-platform
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsample.js
41 lines (32 loc) · 1011 Bytes
/
sample.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
var express = require('express');
var API = require('./lib/api');
var Proxy = require('./lib/proxy');
var Platform = require('./platform');
var cookieParser = require('cookie-parser');
var bodyParser = require('body-parser');
var cors = require('cors');
// Different routers
var router = express.Router();
var proxyRouter = express.Router();
/** @type Number **/
var PORT = process.env.PORT || 8080;
/** @type bungieNetPlatform **/
var platform = Platform("bungled=8025883854554820751");
// Setup server
var app = express();
// general server settings
app.set('view engine', 'jade');
app.set('views', './views');
// express middlewares
app.use(cors({ origin: true, credentials: true }));
app.use(bodyParser());
app.use(cookieParser());
app.use(express.static('./public'));
app.use('/api', router);
app.use('/proxy', proxyRouter);
/** @type API **/
var api = new API(router, platform);
var proxy = new Proxy(proxyRouter);
app.listen(PORT, function() {
console.log('Magic happening on port '+PORT);
});