mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-24 22:55:13 +00:00
33 lines
793 B
JavaScript
33 lines
793 B
JavaScript
import bodyParser from 'body-parser'
|
|
import session from 'express-session'
|
|
|
|
export default {
|
|
head: {
|
|
title: 'Auth Routes',
|
|
meta: [
|
|
{ charset: 'utf-8' },
|
|
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
|
|
{ hid: 'description', content: 'Auth Routes example' }
|
|
]
|
|
},
|
|
/*
|
|
** Add server middleware
|
|
** Nuxt uses `connect` module as server
|
|
** So most of express middleware works with nuxt server middleware
|
|
*/
|
|
serverMiddleware: [
|
|
// body-parser middleware
|
|
bodyParser.json(),
|
|
// session middleware
|
|
session({
|
|
secret: 'super-secret-key',
|
|
resave: false,
|
|
saveUninitialized: false,
|
|
cookie: { maxAge: 60000 }
|
|
}),
|
|
// Api middleware
|
|
// We add /api/login & /api/logout routes
|
|
'~/api'
|
|
]
|
|
}
|