正在显示
7 个修改的文件
包含
65 行增加
和
23 行删除
... | ... | @@ -80,18 +80,16 @@ var app = bootable(express()); |
80 | 80 | app.phase(bootable.di.initializers()); |
81 | 81 | app.phase(bootable.di.routes('./routes')); |
82 | 82 | |
83 | -IoC.create('igloo/server').then(function (server) { | |
84 | - app.phase(server); | |
85 | - app.boot(function (err) { | |
83 | +app.boot(function (err) { | |
86 | 84 | |
87 | - if (err) { | |
88 | - console.log(err); | |
89 | - process.exit(-1); | |
90 | - return; | |
91 | - } | |
85 | + if (err) { | |
86 | + console.log(err); | |
87 | + process.exit(-1); | |
88 | + return; | |
89 | + } | |
92 | 90 | |
93 | - }); | |
94 | 91 | }); |
95 | 92 | |
96 | 93 | |
94 | + | |
97 | 95 | module.exports = app; | ... | ... |
... | ... | @@ -27,10 +27,10 @@ function Initializer() { |
27 | 27 | Initializer.prototype.run = function (cb, thisArg) { |
28 | 28 | var phases = this._phases |
29 | 29 | , idx = 0; |
30 | - | |
31 | 30 | function next(err) { |
32 | - if (err) { return cb(err); } | |
33 | 31 | |
32 | + if (err) { return cb(err); } | |
33 | + console.log("@@@###:::::::::", phases); | |
34 | 34 | var phase = phases[idx++]; |
35 | 35 | // 所有启动项执行完毕 |
36 | 36 | if (!phase) { return cb(); } | ... | ... |
etc/init/05-server.js
0 → 100644
... | ... | @@ -11,7 +11,7 @@ var path = require('path') |
11 | 11 | exports = module.exports = function (logger, settings) { |
12 | 12 | |
13 | 13 | return function (done) { |
14 | - | |
14 | + console.log("@#####$$$$$::::", done); | |
15 | 15 | if (cluster.isMaster && settings.server.cluster) { |
16 | 16 | |
17 | 17 | var size = settings.server.cluster.size || os.cpus().length | ... | ... |
... | ... | @@ -12,17 +12,17 @@ IoC.use('igloo', require('./igloo')); |
12 | 12 | |
13 | 13 | var app = bootable(express()); |
14 | 14 | |
15 | -app.pushPhase = function (phase) { | |
16 | - new Promise(function (resolve, reject) { | |
17 | - phase(resolve, reject) | |
18 | - }).then(function (data) { | |
19 | - app.phase(bootable.di.initializers()); | |
20 | - app.phase(bootable.di.routes('./routes')); | |
21 | - IoC.create('igloo/server').then(function (server) { | |
22 | - app.phase(server); | |
23 | - }); | |
24 | - }); | |
25 | -}; | |
15 | +// app.pushPhase = function (phase) { | |
16 | +// new Promise(function (resolve, reject) { | |
17 | +// phase(resolve, reject) | |
18 | +// }).then(function (data) { | |
19 | +app.phase(bootable.di.initializers()); | |
20 | +// app.phase(bootable.di.routes('./routes')); | |
21 | +// IoC.create('igloo/server').then(function (server) { | |
22 | +// app.phase(server); | |
23 | +// }); | |
24 | +// }); | |
25 | +// }; | |
26 | 26 | |
27 | 27 | var workaiExpress = { |
28 | 28 | 'app': app, | ... | ... |
public/index.ejs
0 → 100644
1 | +<!DOCTYPE html> | |
2 | +<html lang="en"> | |
3 | + | |
4 | +<head> | |
5 | + <meta charset="UTF-8"> | |
6 | + <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
7 | + <meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
8 | + <title>Document</title> | |
9 | +</head> | |
10 | + | |
11 | +<body> | |
12 | + hello word234 | |
13 | +</body> | |
14 | + | |
15 | +</html> | |
\ No newline at end of file | ... | ... |
web.js
0 → 100644
1 | +/* eslint-disable no-var */ | |
2 | +var path = require('path'); | |
3 | +var workaiExpress = require('./index'); | |
4 | + | |
5 | +var app = workaiExpress.app; | |
6 | +var IoC = workaiExpress.IoC; | |
7 | +var bootable = workaiExpress.bootable; | |
8 | + | |
9 | +IoC.use(IoC.dir(path.join(__dirname, 'boot')));//重载配置 | |
10 | + | |
11 | +app.phase(bootable.di.routes('./routes'));//载入路由 | |
12 | + | |
13 | +app.boot(function (err) { | |
14 | + if (err) { | |
15 | + console.log(err); | |
16 | + process.exit(-1); | |
17 | + return; | |
18 | + } | |
19 | +}); | |
20 | + | |
21 | + | ... | ... |
请
注册
或
登录
后发表评论