forked from wtrocki/fh-data-gen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
application.js
28 lines (22 loc) · 931 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
var mbaasApi = require('fh-mbaas-api');
var express = require('express');
var mbaasExpress = mbaasApi.mbaasExpress();
var cors = require('cors');
var app = express();
// Enable CORS for all requests
app.use(cors());
app.use('/sys', mbaasExpress.sys());
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('/hello', require('./lib/routes/hello.js')());
app.use('/user', require('./lib/routes/user.js')());
// Important that this is last!
app.use(mbaasExpress.errorHandler());
var port = process.env.FH_PORT || process.env.OPENSHIFT_NODEJS_PORT || 3000;
var host = process.env.OPENSHIFT_NODEJS_IP || '0.0.0.0';
app.listen(port, host, function() {
console.log("App started at: " + new Date() + " on port: " + port);
});