mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +00:00
examples(with-sockets): create server inside export function (#6396)
This commit is contained in:
parent
8e34632066
commit
0e0149d821
@ -1,10 +1,10 @@
|
||||
import http from 'http'
|
||||
import socketIO from 'socket.io'
|
||||
|
||||
const server = http.createServer(this.nuxt.renderer.app)
|
||||
const io = socketIO(server)
|
||||
|
||||
export default function () {
|
||||
const server = http.createServer(this.nuxt.renderer.app)
|
||||
const io = socketIO(server)
|
||||
|
||||
// overwrite nuxt.server.listen()
|
||||
this.nuxt.server.listen = (port, host) => new Promise(resolve => server.listen(port || 3000, host || 'localhost', resolve))
|
||||
// close this server on 'close' event
|
||||
|
Loading…
Reference in New Issue
Block a user