Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yohobuywap-node
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Plain Diff
Browse Files
Authored by
陈峰
8 years ago
Commit
3977b5b9748998a2ca319aeedfa9c149b629e58e
2 parents
a57388e1
f88e3ef0
Merge branch 'feature/11.11' of
http://git.yoho.cn/fe/yohobuywap-node
into feature/11.11
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
5 deletions
config/common.js
doraemon/middleware/page-cache.js
config/common.js
View file @
3977b5b
...
...
@@ -16,8 +16,8 @@ module.exports = {
siteUrl
:
'//m.yohobuy.com'
,
assetUrl
:
'//localhost:5001'
,
domains
:
{
api
:
'http://api-test3.yohops.com:9999/'
,
service
:
'http://service-test3.yohops.com:9999/'
,
api
:
'http://api.yoho.cn/'
,
service
:
'http://service.yoho.cn/'
,
liveApi
:
'http://testapi.live.yohops.com:9999/'
,
singleApi
:
'http://api-test3.yohops.com:9999/'
...
...
@@ -67,7 +67,7 @@ module.exports = {
port
:
'4444'
// influxdb port
},
console
:
{
level
:
'
debug
'
,
level
:
'
error
'
,
colorize
:
'all'
,
prettyPrint
:
true
}
...
...
doraemon/middleware/page-cache.js
View file @
3977b5b
'use strict'
;
const
path
=
require
(
'path'
);
const
cachePage
=
require
(
'../../config/cache'
);
const
logger
=
global
.
yoho
.
logger
;
const
_
=
require
(
'lodash'
);
function
urlJoin
(
a
,
b
)
{
if
(
_
.
endsWith
(
a
,
'/'
)
&&
_
.
startsWith
(
b
,
'/'
))
{
return
a
+
b
.
substring
(
1
,
b
.
length
);
}
else
if
(
!
_
.
endsWith
(
a
,
'/'
)
&&
!
_
.
startsWith
(
b
,
'/'
))
{
return
a
+
'/'
+
b
;
}
else
{
return
a
+
b
;
}
}
module
.
exports
=
()
=>
{
return
(
req
,
res
,
next
)
=>
{
...
...
@@ -11,7 +21,7 @@ module.exports = () => {
function
onRender
()
{
let
route
=
req
.
route
?
req
.
route
.
path
:
''
;
let
appPath
=
req
.
app
.
mountpath
;
let
key
=
path
.
j
oin
(
appPath
,
route
.
toString
());
// route may be a regexp
let
key
=
urlJ
oin
(
appPath
,
route
.
toString
());
// route may be a regexp
req
.
app
.
set
(
'etag'
,
false
);
...
...
Please
register
or
login
to post a comment