我使用建築師組織我的節點調查項目如何使用cloud9的architect.js創建插件的實例?
https://github.com/c9/architect
在下面的介紹中的滑座66就說明你應該如何創建插件的實例。
http://www.slideshare.net/sergimansilla/architecting-large-nodejs-applications-14912706
下面是摘錄:
function startNewGame(name) {
var game = db.createNewGame(name);
var config = [
{
packagePath: "./game-status",
game: game
}
];
architect.createApp(/* snip */)
我不能工作OUT參數,都應該進入createApp什麼。在該文檔中僅提及了已經從磁盤加載像這樣
var architect_config = architect.loadConfig(path.join(__dirname, 'plugins.json'));
當我嘗試並加載配置直接象在上面的例子中,它會引發錯誤
/code/npm_module_tests/architect_test/node_modules/architect/architect.js:423
throw err;
^
Error: Plugin is missing the setup function {"packagePath":"./app"}
這裏是一個配置我的代碼
var path = require('path');
var architect = require('architect');
var config = [{
"packagePath": "./app2"
}]
var arch = architect.createApp(config, function(){
console.log('application started');
});
那麼如何使用architect.js創建插件的實例?
編輯:
我已經通過代碼讀取好像需要通過假定的配置是磁盤上的loadConfig方法制備的配置。隨着幻燈片的提示,您怎麼能夠將插件的實例插入到配置中?
錯字parckagePath應packagePath – KeepCalmAndCarryOn
謝謝,但這不是問題。那只是我輸入幻燈片而已。 –