File tree Expand file tree Collapse file tree 1 file changed +5
-11
lines changed Expand file tree Collapse file tree 1 file changed +5
-11
lines changed Original file line number Diff line number Diff line change @@ -19,17 +19,11 @@ async function start () {
19
19
await builder . build ( )
20
20
}
21
21
22
- app . use ( async ( ctx , next ) => {
23
- await next ( )
24
- ctx . status = 200 // koa defaults to 404 when it sees that status is unset
25
- return new Promise ( ( resolve , reject ) => {
26
- ctx . res . on ( 'close' , resolve )
27
- ctx . res . on ( 'finish' , resolve )
28
- nuxt . render ( ctx . req , ctx . res , promise => {
29
- // nuxt.render passes a rejected promise into callback on error.
30
- promise . then ( resolve ) . catch ( reject )
31
- } )
32
- } )
22
+ app . use ( ctx => {
23
+ ctx . status = 200
24
+ ctx . respond = false // Mark request as handled for Koa
25
+ ctx . req . ctx = ctx // This might be useful later on, e.g. in nuxtServerInit or with nuxt-stash
26
+ nuxt . render ( ctx . req , ctx . res )
33
27
} )
34
28
35
29
app . listen ( port , host )
You can’t perform that action at this time.
0 commit comments