Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
CivManage
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ReactWeb5
CivManage
Commits
a7a26393
Commit
a7a26393
authored
Nov 03, 2020
by
张烨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: add second proxy
parent
4332da74
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
1 deletion
+45
-1
.env
.env
+9
-1
addDevMiddlewares.js
server/middlewares/addDevMiddlewares.js
+24
-0
config.js
src/routes/config.js
+12
-0
No files found.
.env
View file @
a7a26393
# PUBLIC_PATH = reactOMS
# PUBLIC_PATH = reactOMS
, 默认转发 /cityinterface
PROXY = http://localhost:8005/
# 可设置第二个代理,test为转发前缀,后面为代理转发的地址
# PROXY2 = test : http://localhost:8006/
# 本地应用启动的host域名
HOST = localhost
# 本地应用启动的端口
PORT = 3001
\ No newline at end of file
server/middlewares/addDevMiddlewares.js
View file @
a7a26393
...
...
@@ -61,6 +61,30 @@ module.exports = function addDevMiddlewares(app, webpackConfig) {
},
}),
);
const
proxy2
=
process
.
env
.
PROXY2
;
if
(
proxy2
)
{
const
reg
=
/
(\w
+
)\s
+:
\s
+
([\w
:
/]
+
)
/
;
const
match
=
proxy2
.
match
(
reg
);
const
[,
pre
,
host
]
=
match
;
logger
.
info
(
`using proxy2 at:
${
host
}
`
);
logger
.
info
(
`proxy2 prefix:
${
pre
}
`
);
app
.
use
(
pre
,
createProxyMiddleware
({
target
:
host
,
changeOrigin
:
true
,
// eslint-disable-next-line no-unused-vars
onProxyReq
:
(
_prexyReq
,
_req
,
_res
)
=>
{
logger
.
info
(
'onProxyReq2'
);
},
// eslint-disable-next-line no-unused-vars
onProxyRes
(
_proxyRes
,
_req
,
_res
)
{
logger
.
info
(
'onProxyRes2'
);
},
}),
);
}
}
app
.
get
(
'*'
,
(
_req
,
res
)
=>
{
...
...
src/routes/config.js
View file @
a7a26393
import
React
from
'react'
;
import
{
omit
}
from
'lodash'
;
import
{
DatabaseOutlined
,
UsergroupAddOutlined
,
...
...
@@ -21,7 +22,13 @@ import RoleManage from '../pages/userCenter/RoleManage';
import
SiteManage
from
'../pages/userCenter/SiteManage'
;
// import DefaultComponent from '../pages/orgnazation/DefaultComponent';
import
TestTable
from
'../pages/orgnazation/TestTable'
;
import
{
USER_MODE
}
from
'@/utils/constants'
;
const
iconStyle
=
{
verticalAlign
:
'0.125em'
};
const
superAuthority
=
[
USER_MODE
.
SUPER
];
const
adminAuthority
=
[...
superAuthority
,
USER_MODE
.
ADMIN
];
const
commonAuthority
=
[...
adminAuthority
,
USER_MODE
.
COMMON
];
export
default
{
routes
:
[
{
...
...
@@ -50,6 +57,7 @@ export default {
name
:
'数据库管理'
,
icon
:
<
DatabaseOutlined
style
=
{
iconStyle
}
/>
,
component
:
BlankLayout
,
authority
:
adminAuthority
,
routes
:
[
{
path
:
'/dbm/dbInit'
,
...
...
@@ -67,6 +75,7 @@ export default {
path
:
'/userCenter'
,
name
:
'用户中心'
,
component
:
BlankLayout
,
authority
:
commonAuthority
,
icon
:
<
UsergroupAddOutlined
style
=
{
iconStyle
}
/>
,
routes
:
[
{
...
...
@@ -97,6 +106,7 @@ export default {
component
:
BlankLayout
,
name
:
'平台中心'
,
icon
:
<
SettingOutlined
style
=
{
iconStyle
}
/>
,
authority
:
commonAuthority
,
routes
:
[
{
path
:
'/platformCenter/gis'
,
...
...
@@ -135,6 +145,7 @@ export default {
component
:
BlankLayout
,
name
:
'产品中心'
,
icon
:
<
HomeOutlined
style
=
{
iconStyle
}
/>
,
authority
:
commonAuthority
,
routes
:
[
{
path
:
'/productCenter/web'
,
...
...
@@ -158,6 +169,7 @@ export default {
component
:
BlankLayout
,
name
:
'日志管理'
,
icon
:
<
CopyOutlined
style
=
{
iconStyle
}
/>
,
authority
:
commonAuthority
,
routes
:
[
{
path
:
'/log'
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment