add framework for sessions
This commit is contained in:
parent
65c02922c7
commit
dfe54dd784
5 changed files with 20 additions and 1 deletions
12
server/controllers/sessions.controller.js
Normal file
12
server/controllers/sessions.controller.js
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
|
||||||
|
export function newSession(req, res) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
export function destroySession(req, res) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
export function createSession(req, res) {
|
||||||
|
|
||||||
|
}
|
0
server/controllers/user.controller.js
Normal file
0
server/controllers/user.controller.js
Normal file
7
server/routes/session.routes.js
Normal file
7
server/routes/session.routes.js
Normal 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);
|
0
server/routes/user.routes.js
Normal file
0
server/routes/user.routes.js
Normal 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'));
|
||||||
|
|
Loading…
Reference in a new issue