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
郭成尧
8 years ago
Commit
347a58caff9a85fc449d623a979e2c6ca66892fc
1 parent
3423d91c
udid
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
0 deletions
app.js
app.js
View file @
347a58c
...
...
@@ -16,6 +16,7 @@ const path = require('path');
const
bodyParser
=
require
(
'body-parser'
);
const
cookieParser
=
require
(
'cookie-parser'
);
const
favicon
=
require
(
'serve-favicon'
);
const
uuid
=
require
(
'uuid'
);
const
pkg
=
require
(
'./package.json'
);
const
session
=
require
(
'cookie-session'
);
...
...
@@ -66,6 +67,12 @@ app.use((req, res, next) => {
req
.
user
=
{};
// 全局的用户数据
req
.
yoho
=
{};
// req和res绑定yoho对象,用于传递全局数据, 如req.yoho.channel等
if
(
!
req
.
session
.
id
)
{
req
.
session
.
id
=
uuid
.
v4
();
}
req
.
sessionID
=
req
.
session
.
id
;
next
();
});
...
...
Please
register
or
login
to post a comment