File tree Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -4,15 +4,14 @@ import http from 'http';
44// Use `app#callback()` method here instead of directly
55// passing `app` as an argument to `createServer` (or use `app#listen()` instead)
66// @see https://github.com/koajs/koa/blob/master/docs/api/index.md#appcallback
7- const server = http . createServer ( app . callback ( ) ) ;
8-
9- let currentApp = app ;
7+ let currentHandler = app . callback ( ) ;
8+ const server = http . createServer ( currentHandler ) ;
109
1110server . listen ( process . env . PORT || 3000 , ( error ) => {
1211 if ( error ) {
1312 console . log ( error )
1413 }
15-
14+
1615 console . log ( '🚀 started' )
1716} ) ;
1817
@@ -21,9 +20,9 @@ if (module.hot) {
2120
2221 module . hot . accept ( './server' , ( ) => {
2322 console . log ( '🔁 HMR Reloading `./server`...' ) ;
24- server . removeListener ( 'request' , currentApp ) ;
25- const newApp = require ( './server' ) . default ;
26- server . on ( 'request' , newApp ) ;
27- currentApp = newApp ;
23+ server . removeListener ( 'request' , currentHandler ) ;
24+ const newHandler = require ( './server' ) . default . callback ( ) ;
25+ server . on ( 'request' , newHandler ) ;
26+ currentHandler = newHandler ;
2827 } ) ;
2928}
You can’t perform that action at this time.
0 commit comments