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
Email Patches
Plain Diff
Browse Files
Authored by
郭成尧
9 years ago
Commit
5dc232d331ed226a55dc948231e500a8e08273d1
1 parent
24cf689e
'shop-domain-support'
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
0 deletions
app.js
doraemon/middleware/shop-check.js
app.js
View file @
5dc232d
...
...
@@ -38,6 +38,7 @@ global.utils = path.resolve('./utils');
const
logger
=
global
.
yoho
.
logger
;
app
.
set
(
'subdomain offset'
,
3
);
app
.
set
(
'view engine'
,
'.hbs'
);
app
.
set
(
'views'
,
'./doraemon/views'
);
app
.
engine
(
'.hbs'
,
hbs
({
...
...
@@ -82,6 +83,7 @@ app.use((req, res, next) => {
// dispatcher
try
{
const
shopCheck
=
require
(
'./doraemon/middleware/shop-check'
);
const
user
=
require
(
'./doraemon/middleware/user'
);
const
setYohoData
=
require
(
'./doraemon/middleware/set-yoho-data'
);
const
errorHanlder
=
require
(
'./doraemon/middleware/error-handler'
);
...
...
@@ -89,6 +91,7 @@ try {
// YOHO 前置中间件
app
.
use
(
shopCheck
());
app
.
use
(
setYohoData
());
app
.
use
(
user
());
app
.
use
(
setPageInfo
());
...
...
doraemon/middleware/shop-check.js
0 → 100644
View file @
5dc232d
/**
* Created by PhpStorm.
* User: Targaryen
* Date: 2016/8/29
* Time: 15:27
*/
'use strict'
;
module
.
exports
=
()
=>
{
return
(
req
,
res
,
next
)
=>
{
if
(
req
.
subdomains
.
length
)
{
req
.
url
=
'/product/index/brand?domain='
+
req
.
subdomains
[
0
];
}
next
();
};
};
...
...
Please
register
or
login
to post a comment