Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to express 4.x fixes #99 #107

Merged
merged 2 commits into from
Jan 28, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 15 additions & 14 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
var utils = require( 'utils' )
, parser = require( 'body-parser' )
, compress = require( 'compression' )
, override = require( 'method-override' )
, resTime = require( 'response-time' )
, timeout = require( 'connect-timeout' )
, logger = require( 'morgan' )
, env = utils.bootstrapEnv()
, moduleLdr = env.moduleLoader
, cors = require( 'cors' )
Expand All @@ -12,15 +18,13 @@ debug( 'started with pid %s', chalk.yellow( process.pid ) );
moduleLdr.on( 'preLoadModules', function() {
debug( 'Configuring express application...' );

app.configure(function() {
app.use( express.urlencoded() );
app.use( express.json() );
app.use( express.logger('dev') );
app.use( express.compress() );
app.use( express.favicon() );
app.use( express.methodOverride() );
app.use( cors( env.config.cors ) );
});
app.use( timeout( '30s' ) );
app.use( parser.urlencoded( { extended: true } ) );
app.use( parser.json() );
app.use( logger( 'dev' ) );
app.use( compress() );
app.use( override() );
app.use( cors( env.config.cors ) );
});

moduleLdr.on( 'modulesLoaded', function() {
Expand All @@ -32,11 +36,8 @@ moduleLdr.on( 'modulesLoaded', function() {
moduleLdr.on( 'routesInitialized', function() {
debug( 'Setting up router and starting http server...' );

app.configure(function() {
app.use( app.router );
app.listen( env.webPort, function() {
debug( 'Started web server on port %s in enviromment %s', chalk.yellow( env.webPort ), chalk.yellow( process.env.NODE_ENV ? process.env.NODE_ENV : "LOCAL" ) );
});
app.listen( env.webPort, function() {
debug( 'Started web server on port %s in enviromment %s', chalk.yellow( env.webPort ), chalk.yellow( process.env.NODE_ENV ? process.env.NODE_ENV : "LOCAL" ) );
});
});

Expand Down
2 changes: 1 addition & 1 deletion lib/utils/moduleLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ var ModuleLoader = module.exports = Class.extend(
module.debug( 'Module.configureApp() hook...' );

module.on( 'appReady', callback );
injector.getInstance( 'app' ).configure( module.proxy( 'configureApp', injector.getInstance( 'app' ), injector.getInstance( 'express' ) ) );
module.proxy( 'configureApp', injector.getInstance( 'app' ), injector.getInstance( 'express' ) )();
} else {
callback( null );
}
Expand Down
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,22 @@
"dependencies": {
"async": "~0.9.0",
"bluebird": "~2.9.2",
"body-parser": "~1.10.2",
"chalk": "~0.5.1",
"clever-controller": "~1.1.6",
"clever-injector": "~1.0.2",
"compression": "~1.3.0",
"cors": "~2.5.2",
"debug": "~2.1.0",
"deepmerge": "~0.2.7",
"ejs": "~2.2.3",
"express": "~3.4.7",
"express": "~4.11.1",
"i": "~0.3.2",
"matchdep": "~0.3.0",
"method-override": "~2.3.1",
"morgan": "~1.5.1",
"nconf": "~0.6.9",
"response-time": "~2.2.0",
"sendgrid": "~1.5.0",
"uberclass": "~1.0.1",
"underscore": "~1.7.0",
Expand Down