优化打包方法

This commit is contained in:
aixianling
2023-01-18 12:08:51 +08:00
parent de3549d82e
commit 766faee96e
7 changed files with 124 additions and 14 deletions

View File

@@ -1,17 +1,19 @@
const express = require('express')
const db = require('./src/utils/dbUitls')
const rest = require('./src/rest')
const app = express()
const ws = require('./src/websocket')
const ews = require('express-ws')
const chalk = require("chalk");
const log = console.log
const app = express();
ews(app)
const port = 12525
chalk.level = 1
app.listen(port, () => {
console.log('启动数据库连接池...')
db.init()
console.log('启动接口...')
app.use(express.json()) // for parsing application/json
app.use(express.urlencoded({ extended: true })) // for parsing application/x-www-form-urlencoded
rest.init(app).then(()=>{
console.log(`serve is listening on ${port}`)
app.use(express.urlencoded({extended: true})) // for parsing application/x-www-form-urlencoded
Promise.all([rest.init(app), ws.init(app)]).then(() => {
log(`${chalk.bgGreen.black(" DONE ")} serve is listening on ${port}`)
})
})