add framework for sessions

This commit is contained in:
catarak 2016-05-13 16:49:56 -04:00
parent d8bdc9a232
commit 4c8684877e
3 changed files with 3 additions and 18 deletions

View File

@ -35,7 +35,6 @@
"dependencies": {
"axios": "^0.12.0",
"babel-core": "^6.8.0",
<<<<<<< HEAD
"bcrypt-nodejs": "0.0.3",
"body-parser": "^1.15.1",
"classnames": "^2.2.5",
@ -50,14 +49,6 @@
"passport-github": "^1.1.0",
"passport-jwt": "^2.0.0",
"passport-local": "^1.0.0",
=======
"body-parser": "^1.15.1",
"classnames": "^2.2.5",
"codemirror": "^5.14.2",
"cookie-parser": "^1.4.1",
"express": "^4.13.4",
"mongoose": "^4.4.16",
>>>>>>> add session and cookie and passport config for server
"react": "^15.0.2",
"react-dom": "^15.0.2",
"react-inlinesvg": "^0.4.2",

View File

@ -1,6 +1,7 @@
import { Router } from 'express';
import * as SessionController from '../controllers/session.controller';
import passport from 'passport';
const router = new Router();
router.route('/login').get(SessionController.newSession);
@ -9,4 +10,4 @@ router.route('/login').post(SessionController.createSession);
router.route('/logout').get(SessionController.destroySession);
//TODO add github authentication stuff
//TODO add github authentication stuff

View File

@ -24,18 +24,11 @@ import serverConfig from './config';
import users from './routes/user.routes';
//Body parser, cookie parser, sessions, serve public assets
//Body parser, cookie parser, sessions, serve public assets
app.use(bodyParser.urlencoded({extended: true}));
app.use(bodyParser.json());
app.use(cookieParser());
app.use(session({secret: 'steve brule'}));
app.use(passport.initialize());
app.use(passport.session());
app.use(Express.static(path.resolve(__dirname, '../static')));
app.use(bodyParser.urlencoded({extended: true}));
app.use(bodyParser.json());
app.use(cookieParser());
app.use(session({secret: 'steve brule'}));
app.use(passport.initialize());
app.use(passport.session());
app.use('/', users);