Created
March 7, 2017 21:17
-
-
Save mhaagens/99c6880fa219fd3fef9cf898eacd3bdb to your computer and use it in GitHub Desktop.
Koa HMR
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import http from 'http'; | |
import app from './server'; | |
const port = 3000; | |
const server = http.createServer(app.callback()).listen(3000); | |
if (module.hot) { | |
module.hot.accept('./server', () => { | |
server.removeAllListeners('request', server); | |
server.on('request', app.callback()) | |
}); | |
} | |
console.log(`Server running on: http://localhost: ${port}`); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment