Skip to content

Commit

Permalink
fix: session not saved issue
Browse files Browse the repository at this point in the history
  • Loading branch information
clarkdo committed Oct 31, 2017
1 parent 2b3d32e commit 9f71d76
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions server/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,6 @@ async function start () {
await next()
})

const SESSION_CONFIG = {
key: consts.SESS_KEY
}
// session for flash messages (uses signed session cookies, with no server storage)
app.use(session(SESSION_CONFIG, app))

const nuxt = new Nuxt(config)
nuxt.showOpen = () => {
const _host = host === '0.0.0.0' ? 'localhost' : host
Expand Down Expand Up @@ -102,6 +96,13 @@ async function start () {
await nuxtRender(ctx)
}
})

const SESSION_CONFIG = {
key: consts.SESS_KEY
}
// session for flash messages (uses signed session cookies, with no server storage)
app.use(session(SESSION_CONFIG, app))

// return response time in X-Response-Time header
app.use(async function responseTime (ctx, next) {
const t1 = Date.now()
Expand Down Expand Up @@ -137,7 +138,6 @@ async function start () {
await compose(api.middleware)(ctx)
break
}
await next()
})

app.listen(port, host)
Expand Down

0 comments on commit 9f71d76

Please sign in to comment.