Skip to content

Commit

Permalink
upgrading to express 4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Sevilleja committed May 4, 2014
1 parent 31c0670 commit 020dea0
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 16 deletions.
10 changes: 8 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "node-authentication",
"main": "server.js",
"dependencies" : {
"express" : "~3.4.4",
"express" : "~4.0.0",
"ejs" : "~0.8.5",
"mongoose" : "~3.8.1",
"passport" : "~0.1.17",
Expand All @@ -11,6 +11,12 @@
"passport-twitter" : "~1.0.2",
"passport-google-oauth" : "~0.1.5",
"connect-flash" : "~0.1.1",
"bcrypt-nodejs" : "latest"
"bcrypt-nodejs" : "latest",

"morgan": "~1.0.0",
"body-parser": "~1.0.0",
"cookie-parser": "~1.0.0",
"method-override": "~1.0.0",
"express-session": "~1.0.0"
}
}
29 changes: 15 additions & 14 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,30 @@ var mongoose = require('mongoose');
var passport = require('passport');
var flash = require('connect-flash');

var morgan = require('morgan');
var cookieParser = require('cookie-parser');
var bodyParser = require('body-parser');
var session = require('express-session');

var configDB = require('./config/database.js');

// configuration ===============================================================
mongoose.connect(configDB.url); // connect to our database

require('./config/passport')(passport); // pass passport for configuration

app.configure(function() {

// set up our express application
app.use(express.logger('dev')); // log every request to the console
app.use(express.cookieParser()); // read cookies (needed for auth)
app.use(express.bodyParser()); // get information from html forms

app.set('view engine', 'ejs'); // set up ejs for templating
// set up our express application
app.use(morgan('dev')); // log every request to the console
app.use(cookieParser()); // read cookies (needed for auth)
app.use(bodyParser()); // get information from html forms

// required for passport
app.use(express.session({ secret: 'ilovescotchscotchyscotchscotch' })); // session secret
app.use(passport.initialize());
app.use(passport.session()); // persistent login sessions
app.use(flash()); // use connect-flash for flash messages stored in session
app.set('view engine', 'ejs'); // set up ejs for templating

});
// required for passport
app.use(session({ secret: 'ilovescotchscotchyscotchscotch' })); // session secret
app.use(passport.initialize());
app.use(passport.session()); // persistent login sessions
app.use(flash()); // use connect-flash for flash messages stored in session

// routes ======================================================================
require('./app/routes.js')(app, passport); // load our routes and pass in our app and fully configured passport
Expand Down

0 comments on commit 020dea0

Please sign in to comment.