-
Notifications
You must be signed in to change notification settings - Fork 3
/
application.js
28 lines (22 loc) · 933 Bytes
/
application.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
require("./global");
log.info("starting..");
var app = express();
var server=require("http").Server(app);
require("./ws")(server);
// Enable CORS for all requests
app.use(cors());
// Note: the order which we add middleware to Express here is important!
app.use('/sys', mbaasExpress.sys(securableEndpoints));
app.use('/mbaas', mbaasExpress.mbaas);
// allow serving of static files from the public directory
// app.use(express.static(__dirname + '/public'));
// Note: important that this is added just before your own Routes
app.use(mbaasExpress.fhmiddleware());
// app.use('/v1', require('./routes/v1.js')());
// Important that this is last!
app.use(mbaasExpress.errorHandler());
var port = process.env.FH_PORT || process.env.OPENSHIFT_NODEJS_PORT || 8010;
var host = process.env.OPENSHIFT_NODEJS_IP || '0.0.0.0';
server.listen(port, host, function() {
console.log("App started at: " + new Date() + " on port: " + port);
});