Skip to content

Commit

Permalink
add 500ms delay to server response
Browse files Browse the repository at this point in the history
  • Loading branch information
jchansen committed May 27, 2018
1 parent bf00c7f commit 0dc2b78
Show file tree
Hide file tree
Showing 4 changed files with 5,044 additions and 3 deletions.
1 change: 1 addition & 0 deletions api/blueprints/find.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ module.exports = function findRecords (req, res) {
Model.pagify('data', {
findQuery: actionUtil.parseCriteria(req),
sort: params.sort ? [params.sort] : ['createdAt DESC'],
// sort: params.sort ? [params.sort] : [],
page: page,
perPage: perPage,
populate: populate
Expand Down
1 change: 0 additions & 1 deletion api/controllers/TweetController.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,3 @@ module.exports = {
}

};

15 changes: 13 additions & 2 deletions config/http.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ module.exports.http = {
'session',
'passportInit',
'myRequestLogger',
'delay',
'bodyParser',
'handleBodyParserError',
'compress',
Expand All @@ -54,7 +55,7 @@ module.exports.http = {
'favicon',
'404',
'500'
]
],

/****************************************************************************
* *
Expand All @@ -65,7 +66,17 @@ module.exports.http = {
// myRequestLogger: function (req, res, next) {
// console.log("Requested :: ", req.method, req.url);
// return next();
// }
// },

delay: function (req, res, next) {
if (req.method === 'OPTIONS') {
return next();
}

setTimeout(function() {
next();
}, 500);
}


/***************************************************************************
Expand Down
Loading

0 comments on commit 0dc2b78

Please sign in to comment.