Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
Dui123
Project
Project
Details
Activity
Releases
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
王天宇
Dui123
Commits
0c2f0543
Commit
0c2f0543
authored
Nov 02, 2021
by
wty
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
重写阿波罗配置获取12
parent
421d3f75
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
28 deletions
+35
-28
getConfig.js
config/getConfig.js
+2
-0
app.js
server/app.js
+32
-28
log.js
server/routes/log.js
+0
-0
ToolType.scss
src/component/ToolType/ToolType.scss
+1
-0
No files found.
config/getConfig.js
View file @
0c2f0543
...
...
@@ -8,6 +8,8 @@ const getConfig = ()=>{
return
require
(
'../config/prod.json'
)
case
'test'
:
return
require
(
'../config/test.json'
)
case
'local'
:
return
'local'
}
}
...
...
server/app.js
View file @
0c2f0543
...
...
@@ -15,42 +15,43 @@ const ssoRouter = require('./routes/sso')
const
typeManage
=
require
(
'./routes/typeManage'
)
const
Eureka
=
require
(
'eureka-node'
).
default
const
DockerApp
=
require
(
'docker-app-node'
)
const
config
=
require
(
'../config/getConfig'
)()
const
http
=
require
(
'http'
)
const
app
=
express
();
// //本地调试代码套装
// let server = http.createServer(app);
// server.listen(3000)
// global.domain = 'http://172.16.227.78:3000'
//
// console.info(global.domain)
//线上服务代码套装
global
.
domain
=
'http://'
+
os
.
networkInterfaces
()[
'eth0'
][
0
][
'address'
]
+
':3000'
const
dockerApp
=
new
DockerApp
({
app
,
appType
:
'express'
,
port
:
3000
})
if
(
config
===
'local'
){
let
server
=
http
.
createServer
(
app
);
server
.
listen
(
3000
)
global
.
domain
=
'http://172.16.227.78:3000'
}
else
{
global
.
domain
=
'http://'
+
os
.
networkInterfaces
()[
'eth0'
][
0
][
'address'
]
+
':3000'
const
dockerApp
=
new
DockerApp
({
app
,
appType
:
'express'
,
port
:
3000
})
// 注册Eureka
global
.
eureka
=
new
Eureka
({
port
:
3000
,
// 应用端口号
appName
:
'dui123'
,
// 应用名称
services
:
[
'dui123'
]
// 依赖服务名
})
global
.
eureka
=
new
Eureka
({
port
:
3000
,
// 应用端口号
appName
:
'dui123'
,
// 应用名称
services
:
[
'dui123'
]
// 依赖服务名
})
global
.
eureka
.
start
().
then
(()
=>
{
dockerApp
.
startServer
().
then
(()
=>
{
console
.
info
(
'eureka已启动'
)
console
.
info
(
'dockerApp已启动'
)
global
.
eureka
.
start
().
then
(()
=>
{
dockerApp
.
startServer
().
then
(()
=>
{
console
.
info
(
'eureka已启动'
)
console
.
info
(
'dockerApp已启动'
)
})
})
}
)
}
console
.
info
(
global
.
domain
)
//
// app.use((req,res, next) => {
// const {sso_ticket} = req.cookies
...
...
@@ -69,6 +70,12 @@ app.use((req, res, next) => {
const
header
=
{
'Content-Type'
:
''
}
if
(
config
===
'local'
){
header
[
'Access-Control-Allow-Credentials'
]
=
true
header
[
'Access-Control-Allow-Origin'
]
=
req
.
headers
.
origin
||
'*'
header
[
'Access-Control-Allow-Headers'
]
=
'X-Requested-With,Content-Type'
header
[
'Access-Control-Allow-Methods'
]
=
'PUT,POST,GET,DEconstE,OPTIONS'
}
if
(
url
.
includes
(
'static'
)){
if
(
url
.
includes
(
'html'
))
header
[
"Content-Type"
]
=
'text/html; charset=utf-8'
...
...
@@ -91,9 +98,6 @@ app.use(cookieParser());
app
.
engine
(
'html'
,
engines
.
mustache
)
app
.
set
(
'view engine'
,
'html'
)
app
.
set
(
'views'
,
path
.
join
(
__dirname
,
'/staticFile/build'
));
// app.use(favicon(path.join(__dirname, "../static/build/favicon.ico")));
// app.use('/scripts', express.static(path.join(__dirname, 'node_modules')));
// app.use(express.static(path.join(__dirname, 'build')));
app
.
get
(
'/'
,
function
(
req
,
res
){
res
.
type
(
'html'
)
res
.
render
(
'index.html'
);
...
...
server/routes/log.js
0 → 100644
View file @
0c2f0543
src/component/ToolType/ToolType.scss
View file @
0c2f0543
...
...
@@ -20,6 +20,7 @@
text-align
:
center
;
cursor
:
pointer
;
margin
:
0
10px
0
;
padding
:
0
10px
;
// border-bottom: 2px solid #cccccc;
}
...
...
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