Update server.js

This commit is contained in:
chaoszhu 2022-09-29 15:59:30 +08:00 committed by GitHub
parent bfd8f84f3f
commit 4f7d6bc886
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -17,7 +17,7 @@ const httpServer = () => {
const server = http.createServer(app.callback())
serverHandler(app, server)
// ws一直报跨域的错误参照官方文档使用createServer API创建服务
server.listen(httpPort, () => {
server.listen(process.env.PORT || httpPort, () => {
consola.success(`Server(http) is running on: http://localhost:${ httpPort }`)
})
}
@ -65,4 +65,4 @@ module.exports = {
httpServer,
httpsServer,
clientHttpServer
}
}