正在显示
3 个修改的文件
包含
14 行增加
和
4 行删除
@@ -7,7 +7,7 @@ var bootable = require('bootable') | @@ -7,7 +7,7 @@ var bootable = require('bootable') | ||
7 | var _ = require('underscore') | 7 | var _ = require('underscore') |
8 | var updateNotifier = require('update-notifier') | 8 | var updateNotifier = require('update-notifier') |
9 | var path = require('path') | 9 | var path = require('path') |
10 | -var Resource = require('express-resource') | 10 | +var expressResource = require('express-resource') |
11 | 11 | ||
12 | exports = module.exports = function(logger, settings) { | 12 | exports = module.exports = function(logger, settings) { |
13 | 13 | ||
@@ -21,7 +21,7 @@ exports = module.exports = function(logger, settings) { | @@ -21,7 +21,7 @@ exports = module.exports = function(logger, settings) { | ||
21 | updateCheckInterval: settings.updateNotifier.updateCheckInterval | 1000 * 60 * 60, // hourly | 21 | updateCheckInterval: settings.updateNotifier.updateCheckInterval | 1000 * 60 * 60, // hourly |
22 | updateCheckTimeout: settings.updateNotifier.updateCheckTimeout | 1000 * 20 // 20 seconds | 22 | updateCheckTimeout: settings.updateNotifier.updateCheckTimeout | 1000 * 20 // 20 seconds |
23 | }) | 23 | }) |
24 | - if (_.isUndefined(notifier.update)) return | 24 | + if (_.isUndefined(notifier.update) || !_.isString(notifier.update.latest)) return |
25 | logger.warn( | 25 | logger.warn( |
26 | '%s of %s released (current: %s), run `npm install -S %s@%s` to upgrade', | 26 | '%s of %s released (current: %s), run `npm install -S %s@%s` to upgrade', |
27 | notifier.update.latest, | 27 | notifier.update.latest, |
@@ -40,6 +40,9 @@ exports = module.exports = function(logger, settings) { | @@ -40,6 +40,9 @@ exports = module.exports = function(logger, settings) { | ||
40 | if (settings.logger.requests) | 40 | if (settings.logger.requests) |
41 | app.use(winstonRequestLogger.create(logger)) | 41 | app.use(winstonRequestLogger.create(logger)) |
42 | 42 | ||
43 | + // integrate express-resource | ||
44 | + app = expressResource(app) | ||
45 | + | ||
43 | return app | 46 | return app |
44 | 47 | ||
45 | } | 48 | } |
@@ -3,6 +3,7 @@ | @@ -3,6 +3,7 @@ | ||
3 | 3 | ||
4 | var mongoose = require('mongoose') | 4 | var mongoose = require('mongoose') |
5 | var _ = require('underscore') | 5 | var _ = require('underscore') |
6 | +var mongooseTypes = require('nifty-mongoose-types') | ||
6 | 7 | ||
7 | exports = module.exports = function(logger, settings) { | 8 | exports = module.exports = function(logger, settings) { |
8 | 9 | ||
@@ -19,6 +20,11 @@ exports = module.exports = function(logger, settings) { | @@ -19,6 +20,11 @@ exports = module.exports = function(logger, settings) { | ||
19 | logger.info('mongo connection opened') | 20 | logger.info('mongo connection opened') |
20 | }) | 21 | }) |
21 | 22 | ||
23 | + connection.Schema = mongoose.Schema | ||
24 | + connection.SchemaTypes = mongoose.SchemaTypes | ||
25 | + connection.Types = mongoose.SchemaTypes | ||
26 | + mongooseTypes.loadTypes(connection) | ||
27 | + | ||
22 | return connection | 28 | return connection |
23 | 29 | ||
24 | } | 30 | } |
@@ -19,12 +19,13 @@ | @@ -19,12 +19,13 @@ | ||
19 | "commander": "^2.2.0", | 19 | "commander": "^2.2.0", |
20 | "connect-redis": "~2.0.0", | 20 | "connect-redis": "~2.0.0", |
21 | "express": "~4.2.0", | 21 | "express": "~4.2.0", |
22 | - "express-resource": "^1.0.0", | 22 | + "express-resource": "git://github.com/niftylettuce/express-resource", |
23 | + "express-session": "^1.2.1", | ||
23 | "merge-defaults": "^0.1.0", | 24 | "merge-defaults": "^0.1.0", |
24 | "mongoose": "~3.8.7", | 25 | "mongoose": "~3.8.7", |
26 | + "nifty-mongoose-types": "0.0.2", | ||
25 | "to-camel-case": "^0.2.1", | 27 | "to-camel-case": "^0.2.1", |
26 | "underscore": "~1.6.0", | 28 | "underscore": "~1.6.0", |
27 | - "update-notifier": "git://github.com/niftylettuce/update-notifier", | ||
28 | "winston": "git://github.com/niftylettuce/winston", | 29 | "winston": "git://github.com/niftylettuce/winston", |
29 | "winston-mongodb": "~0.4.3", | 30 | "winston-mongodb": "~0.4.3", |
30 | "winston-request-logger": "^1.0.5" | 31 | "winston-request-logger": "^1.0.5" |
请
注册
或
登录
后发表评论