add framework for sessions

This commit is contained in:
catarak 2016-05-13 16:49:56 -04:00
parent 65c02922c7
commit dfe54dd784
5 changed files with 20 additions and 1 deletions

View file

@ -0,0 +1,12 @@
export function newSession(req, res) {
}
export function destroySession(req, res) {
}
export function createSession(req, res) {
}

View file

View file

@ -0,0 +1,7 @@
import { Router } from 'express';
import * as SessionController from '../controllers/session.controller';
const router = new Router();
router.route('/login').get(SessionController.newSession);
router.route('/logout').get(SessionController.destroySession);

View file

View file

@ -23,13 +23,13 @@ app.use(webpackHotMiddleware(compiler));
import serverConfig from './config'; import serverConfig from './config';
//Body parser, cookie parser, sessions, serve public assets //Body parser, cookie parser, sessions, serve public assets
app.use(Express.static(path.resolve(__dirname, '../static')));
app.use(bodyParser.urlencoded({extended: true})); app.use(bodyParser.urlencoded({extended: true}));
app.use(bodyParser.json()); app.use(bodyParser.json());
app.use(cookieParser()); app.use(cookieParser());
app.use(session({secret: 'steve brule'})); app.use(session({secret: 'steve brule'}));
app.use(passport.initialize()); app.use(passport.initialize());
app.use(passport.session()); app.use(passport.session());
app.use(Express.static(path.resolve(__dirname, '../static')));
app.get("/", function(req, res) { app.get("/", function(req, res) {
res.sendFile(path.resolve(__dirname + '/../index.html')); res.sendFile(path.resolve(__dirname + '/../index.html'));