Skip to content
This repository has been archived by the owner on Jan 1, 2024. It is now read-only.

Commit

Permalink
fix(server): move entry to src/index
Browse files Browse the repository at this point in the history
fix(server): move entry to src/index
  • Loading branch information
Metnew committed Feb 18, 2018
1 parent c138972 commit cff2618
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 39 deletions.
26 changes: 26 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import app from './server'
import http from 'http'

const server = http.createServer(app)

let currentApp = app

server.listen(process.env.PORT, error => {
if (error) {
console.log(error)
}

console.log('🚀 started')
})

if (module.hot) {
console.log('✅ Server-side HMR Enabled!')

module.hot.accept('./server', () => {
console.log('🔁 HMR Reloading `./server`...')
server.removeListener('request', currentApp)
const newApp = require('./server').default
server.on('request', newApp)
currentApp = newApp
})
}
19 changes: 0 additions & 19 deletions src/server/index.dev.js

This file was deleted.

20 changes: 0 additions & 20 deletions src/server/index.js

This file was deleted.

0 comments on commit cff2618

Please sign in to comment.