0
내 node.js 응용 프로그램에 다음과 같은 app.js
이 있습니다. 내가 직접 node app.js
과 함께 실행하면 모든 것이 작동합니다. init.d에서 실행할 때, express-load의 항목 중 어느 것도로드되지 않습니다. load
내 모든 컨트롤러와 설정 파일에 간단한 console.log 라인을 추가했으며 아무 것도 기록하지 않습니다.init.do에서 시작할 때 node.js express-load가 작동하지 않습니다.
내가 잘못 했나요?
"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'));
});
감사합니다.이 포인터는 저를 답으로 이끌었습니다. 나는'app.rootDir' 설정 바로 아래에'process.chdir (app.rootDir);'줄을 추가했습니다. – Justin808