Skip to content

Commit 9f71d76

Browse files
committed
fix: session not saved issue
1 parent 2b3d32e commit 9f71d76

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

server/app.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,6 @@ async function start () {
6767
await next()
6868
})
6969

70-
const SESSION_CONFIG = {
71-
key: consts.SESS_KEY
72-
}
73-
// session for flash messages (uses signed session cookies, with no server storage)
74-
app.use(session(SESSION_CONFIG, app))
75-
7670
const nuxt = new Nuxt(config)
7771
nuxt.showOpen = () => {
7872
const _host = host === '0.0.0.0' ? 'localhost' : host
@@ -102,6 +96,13 @@ async function start () {
10296
await nuxtRender(ctx)
10397
}
10498
})
99+
100+
const SESSION_CONFIG = {
101+
key: consts.SESS_KEY
102+
}
103+
// session for flash messages (uses signed session cookies, with no server storage)
104+
app.use(session(SESSION_CONFIG, app))
105+
105106
// return response time in X-Response-Time header
106107
app.use(async function responseTime (ctx, next) {
107108
const t1 = Date.now()
@@ -137,7 +138,6 @@ async function start () {
137138
await compose(api.middleware)(ctx)
138139
break
139140
}
140-
await next()
141141
})
142142

143143
app.listen(port, host)

0 commit comments

Comments
 (0)