У меня есть следующее app.js
для моего приложения node.js. Когда я запускаю его напрямую с node app.js
, все работает. Когда я запускаю его из init.d, ни один из элементов load
из экспресс-загрузки не загружается. Я добавил простую строку console.log во все мои контроллеры и файлы конфигурации, и ни один из них не регистрируется.
Я делаю что-то неправильно?
"use strict";
var express = require('express'), // main js framework
http = require('http'), // node http stack
fs = require('fs'), // filesystem
load = require('express-load'), // enables load ("config").then ("models").into("app")
path = require('path'), // enables multi os capable pathes
configure = require(path.join(__dirname, 'lib', 'configure')),
app = module.exports = express(),
server = http.createServer(app);
app.rootDir = __dirname;
// app settings
load('config/development.js') // load main app config
.then('config/production.js') // then load db models
.then('models') // then load db models
.then('controllers') // then load controllers
.then('config/routes.js') // then load routes
.into(app); // load it all into app
configure.loadConfig(app);
// connect to the db
//var db = require('nano')(app.get('db_conn'));
server.listen(app.get('port'), function () {
console.log("Server listening on port %d in %s mode", app.get('port'), app.get('env'));
});