mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-06 06:03:58 +00:00
36 lines
849 B
JavaScript
36 lines
849 B
JavaScript
const bodyParser = require('body-parser')
|
|
const session = require('express-session')
|
|
|
|
module.exports = {
|
|
head: {
|
|
title: 'Auth Routes',
|
|
meta: [
|
|
{ charset: 'utf-8' },
|
|
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
|
|
{ hid: 'description', content: 'Auth Routes example' }
|
|
]
|
|
},
|
|
build: {
|
|
vendor: ['axios']
|
|
},
|
|
/*
|
|
** 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 }
|
|
}),
|
|
// Api middleware
|
|
// We add /api/login & /api/logout routes
|
|
'~/api'
|
|
]
|
|
}
|