forked from dozoisch/pointsgenie
-
Notifications
You must be signed in to change notification settings - Fork 1
/
server.js
46 lines (38 loc) · 878 Bytes
/
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
45
46
"use strict";
console.log("Node version:", process.version);
require("./register-babel");
/**
* Dependencies
*/
var koa = require("koa");
var c2k = require("koa-connect");
var react = require("react");
var passport = require("koa-passport");
/**
* Config
*/
var config = require("./config/config");
/**
* Database configuration
*/
require("./config/database")(config);
/**
* Server
*/
var app = module.exports = koa();
function addProxy(req, res, next) {
req.proxy = "promo58.ageg.ca";
next();
}
app.use(c2k(addProxy));
require("./config/passport")(passport);
require("./config/koa")(app, passport);
// Routes
require("./src/routes")(app, passport);
// Start app
if (!module.parent) {
app.listen(config.app.port, function () {
console.log("Server started, listening on port:", config.app.port);
console.log("Environment:", config.app.env);
});
}