mirror of
https://github.com/zebrajr/express.git
synced 2025-12-06 12:19:51 +01:00
refactor: improve readability (#6173)
This commit is contained in:
parent
39f5d633b5
commit
e4a61bd88e
|
|
@ -32,7 +32,8 @@ app.param(['to', 'from'], function(req, res, next, num, name){
|
||||||
// Load user by id
|
// Load user by id
|
||||||
|
|
||||||
app.param('user', function(req, res, next, id){
|
app.param('user', function(req, res, next, id){
|
||||||
if (req.user = users[id]) {
|
req.user = users[id]
|
||||||
|
if (req.user) {
|
||||||
next();
|
next();
|
||||||
} else {
|
} else {
|
||||||
next(createError(404, 'failed to find user'));
|
next(createError(404, 'failed to find user'));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user