Files
dvcp-node-service/index.js

25 lines
768 B
JavaScript
Raw Normal View History

2022-03-29 15:04:07 +08:00
const express = require('express')
2023-12-18 15:18:37 +08:00
const xmlparser = require('express-xml-bodyparser');
require("express-async-errors")
2022-04-01 16:05:56 +08:00
const db = require('./src/utils/dbUitls')
const rest = require('./src/rest')
2023-01-18 12:08:51 +08:00
const ws = require('./src/websocket')
const ews = require('express-ws')
const chalk = require("chalk");
const log = console.log
const app = express();
ews(app)
2022-03-29 15:04:07 +08:00
const port = 12525
2023-01-18 12:08:51 +08:00
chalk.level = 1
2022-03-29 15:04:07 +08:00
app.listen(port, () => {
db.init()
2022-03-30 19:19:56 +08:00
app.use(express.json()) // for parsing application/json
2023-12-18 15:18:37 +08:00
app.use(xmlparser());
2023-02-13 11:06:03 +08:00
app.use(express.urlencoded({extended: true, limit: '50mb'})) // for parsing application/x-www-form-urlencoded
2023-12-18 15:18:37 +08:00
2023-06-13 08:56:25 +08:00
Promise.all([rest.init(app)]).then(() => {
2023-01-18 12:08:51 +08:00
log(`${chalk.bgGreen.black(" DONE ")} serve is listening on ${port}`)
2023-06-13 08:56:25 +08:00
ws.init(app)
2022-03-29 15:04:07 +08:00
})
})