1 Star 0 Fork 28

楠尼玛大帝/huaweicloud-solution-ploto

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
http-server.js 1.27 KB
一键复制 编辑 原始数据 按行查看 历史
HWCloudSolution 提交于 2022-03-04 09:54 . 【修改描述】项目初始化
var express = require('express')
var compression = require('compression')
var contextPath = require('./vue.config').publicPath
var http = require('http')
var path = require('path')
var portrange = 8090
var app = express()
app.use(compression())
app.use(contextPath, express.static(path.resolve(__dirname, './dist/')))
app.use(
contextPath,
express.static(path.resolve(__dirname, './node_modules/@aurora/ui/web/'))
)
app.use(
contextPath,
express.static(path.resolve(__dirname, './node_modules/@aurora/service/web/'))
)
app.use(
contextPath,
express.static(
path.resolve(__dirname, './node_modules/@aurora/service-hae/web/')
)
)
app.use(
contextPath,
express.static(
path.resolve(__dirname, './node_modules/@aurora/service-jalor5/web/')
)
)
app.use(contextPath, express.static(path.resolve(__dirname, './web/')))
function getPort(cb) {
var port = portrange
portrange += 1
var server = http.createServer()
server.listen(port, function () {
server.once('close', function () {
cb(port)
})
server.close()
})
server.on('error', function () {
getPort(cb)
})
}
getPort(function (port) {
app.listen(port, function () {
require('child_process').exec(
'start chrome http://localhost.huawei.com:' + port + contextPath
)
})
})
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/yaohaonan/huaweicloud-solution-ploto.git
git@gitee.com:yaohaonan/huaweicloud-solution-ploto.git
yaohaonan
huaweicloud-solution-ploto
huaweicloud-solution-ploto
master

搜索帮助