-
Notifications
You must be signed in to change notification settings - Fork 0
/
rip.js
35 lines (31 loc) · 864 Bytes
/
rip.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
var express = require ('express');
var app = express ();
module.exports = {
app: app,
router: function() {
return express.Router();
},
api: function(name, version) {
return new API(name, version);
},
defaultErrorHandler: function() {
// catch 404 and forward to error handler
app.use (function (req, res, next) {
var err = new Error ('Not Found');
err.status = 404;
next (err);
});
}
};
var API = require ('./runtime/api');
var cors = require('cors');
var compression = require('compression');
var methodOverride = require('method-override');
app.use(cors()); //enable cors for the whole service
app.use(compression());
app.use(methodOverride('X-HTTP-Method-Override'));
if (app.get('env') === 'development') {
require('./runtime/development-runtime');
} else {
require('./runtime/production-runtime');
}