diff --git a/package.json b/package.json index 0f84bec6d..4284578e2 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,10 @@ "main" : "server.js", "author" : "Scotch", "dependencies" : { - "express" : "~3.4.4", - "mongoose" : "~3.6.2" + "express" : "~4.6.1", + "mongoose" : "~3.8.13", + "morgan" : "~1.1.1", + "body-parser" : "~1.4.3", + "method-override" : "~2.1.1" } } diff --git a/server.js b/server.js index 9f8736fac..40000f1db 100644 --- a/server.js +++ b/server.js @@ -4,16 +4,20 @@ var app = express(); // create our app w/ express var mongoose = require('mongoose'); // mongoose for mongodb var port = process.env.PORT || 8080; // set the port var database = require('./config/database'); // load the database config +var morgan = require('morgan'); +var bodyParser = require('body-parser'); +var methodOverride = require('method-override'); // configuration =============================================================== mongoose.connect(database.url); // connect to mongoDB database on modulus.io -app.configure(function() { - app.use(express.static(__dirname + '/public')); // set the static files location /public/img will be /img for users - app.use(express.logger('dev')); // log every request to the console - app.use(express.bodyParser()); // pull information from html in POST - app.use(express.methodOverride()); // simulate DELETE and PUT -}); +app.use(express.static(__dirname + '/public')); // set the static files location /public/img will be /img for users +app.use(morgan()); // log every request to the console +app.use(bodyParser.urlencoded({'extended':'true'})); // parse application/x-www-form-urlencoded +app.use(bodyParser.json()); // parse application/json +app.use(bodyParser.json({ type: 'application/vnd.api+json' })); // parse application/vnd.api+json as json +app.use(methodOverride('X-HTTP-Method-Override')); // override with the X-HTTP-Method-Override header in the request + // routes ====================================================================== require('./app/routes.js')(app);