优化打包方法
This commit is contained in:
18
index.js
18
index.js
@@ -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}`)
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user