forked from DanKottke/midas
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
43 lines (39 loc) · 1.09 KB
/
app.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
/**
* app.js
*
* Use `app.js` to run your app without `sails lift`.
* To start the server, run: `node app.js`.
*
* This is handy in situations where the sails CLI is not relevant or useful.
*
* For example:
* => `node app.js`
* => `forever start app.js`
* => `node debug app.js`
* => `modulus deploy`
* => `heroku scale`
*
*
* The same command-line arguments are supported, e.g.:
* `node app.js --silent --port=80 --prod`
*/
// Ensure we're in the project directory, so relative paths work as expected
// no matter where we actually lift from.
process.chdir(__dirname);
require('app-module-path').addPath('lib/');
const log = require('log')('app');
log.info('start');
(function () {
// Ensure all our dependencies can be located:
try {
require('./app-koa')({});
} catch (e) {
log.error('Error starting app\n');
log.error(e);
if(e.message.match('Cannot find module')) {
var module = e.message.split('Cannot find module ')[1];
log.error('To fix the error please try running `npm install ' + module.replace(/'/g, '') + '`');
}
return;
}
})();