Commit 505d3034 authored by 何虹's avatar 何虹 💬

添加模拟菜单本地服务,用于webframe3.0本地调试

parent 69ff5db7
Pipeline #30511 failed with stages
This source diff could not be displayed because it is too large. You can view the blob instead.
1.如何使线上3.0webframe,加载本地mock菜单
本地菜单存在menu_list.js中
只需要修改对应的app_url、item_url
app_url:对应你本地的服务地址
item_url:对应你需要打开菜单
2. 如何启动这个本地服务菜单
cnpm i
node server
3. 打开webfframe3.0的线上地址
http://iotem-hangzhou.frame.app.hscloud.top/login?mockMenuUrl=http://localhost:9999/menuList
就能加载你这个服务返回的菜单数据了!
\ No newline at end of file
{
"name": "scm",
"version": "0.3.0",
"description": "Node.js on Docker",
"author": "Douwa",
"main": "server.js",
"scripts": {
"start": "node server.js"
},
"dependencies": {
"compression": "^1.7.2",
"cors": "^2.8.5",
"express": "^4.16.3",
"http-proxy-middleware": "^0.17.3"
},
"license": "ISC",
"devDependencies": {
"hsright-route-register": "^1.0.15"
}
}
var express = require('express')
var compression = require('compression')
const cors = require('cors') // 引入cors插件
var app = express()
app.use(compression())
app.use(cors()) // 通过中间件的方式使用cors插件 解决跨域问题
var data = require('./menu_list')
app.get('/menuList', function(req, res) {
res.send(data)
})
var port = process.env.PORT || 9999// 重要的一点
app.listen(port)
console.log('Running on http://localhost:' + port)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment