easynode/client/app/server.js
zhulj 9c05da023f
2022-06-08 16:47:41 +08:00

21 lines
474 B
JavaScript

const http = require('http')
const Koa = require('koa')
const { httpPort } = require('./config')
const wsOsInfo = require('./socket/monitor')
const httpServer = () => {
const app = new Koa()
const server = http.createServer(app.callback())
serverHandler(app, server)
server.listen(httpPort, () => {
console.log(`Server(http) is running on port:${ httpPort }`)
})
}
function serverHandler(app, server) {
wsOsInfo(server)
}
module.exports = {
httpServer
}