Skip to content

Commit

Permalink
Merge pull request #107 from CleverStack/1.2.0
Browse files Browse the repository at this point in the history
Upgrade to express 4.x fixes #99
  • Loading branch information
pilsy committed Jan 28, 2015
2 parents 4e3dc48 + 2da8cee commit 7b4eca5
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 16 deletions.
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

0 comments on commit 7b4eca5

Please sign in to comment.