2018-03-16 16:12:06 +00:00
|
|
|
import bodyParser from 'body-parser'
|
|
|
|
import session from 'express-session'
|
2017-07-08 16:04:47 +00:00
|
|
|
|
2018-03-16 16:12:06 +00:00
|
|
|
export default {
|
2016-12-08 15:39:27 +00:00
|
|
|
head: {
|
|
|
|
title: 'Auth Routes',
|
|
|
|
meta: [
|
|
|
|
{ charset: 'utf-8' },
|
|
|
|
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
|
|
|
|
{ hid: 'description', content: 'Auth Routes example' }
|
|
|
|
]
|
2017-05-29 15:00:01 +00:00
|
|
|
},
|
2017-07-08 16:04:47 +00:00
|
|
|
/*
|
|
|
|
** Add server middleware
|
|
|
|
** Nuxt.js uses `connect` module as server
|
|
|
|
** So most of express middleware works with nuxt.js server middleware
|
|
|
|
*/
|
|
|
|
serverMiddleware: [
|
|
|
|
// body-parser middleware
|
|
|
|
bodyParser.json(),
|
|
|
|
// session middleware
|
|
|
|
session({
|
|
|
|
secret: 'super-secret-key',
|
|
|
|
resave: false,
|
|
|
|
saveUninitialized: false,
|
|
|
|
cookie: { maxAge: 60000 }
|
2017-07-08 16:09:47 +00:00
|
|
|
}),
|
|
|
|
// Api middleware
|
|
|
|
// We add /api/login & /api/logout routes
|
|
|
|
'~/api'
|
|
|
|
]
|
2016-12-08 15:39:27 +00:00
|
|
|
}
|