Skip to content

Commit 0dc2b78

Browse files
committed
add 500ms delay to server response
1 parent bf00c7f commit 0dc2b78

File tree

4 files changed

+5044
-3
lines changed

4 files changed

+5044
-3
lines changed

api/blueprints/find.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ module.exports = function findRecords (req, res) {
4040
Model.pagify('data', {
4141
findQuery: actionUtil.parseCriteria(req),
4242
sort: params.sort ? [params.sort] : ['createdAt DESC'],
43+
// sort: params.sort ? [params.sort] : [],
4344
page: page,
4445
perPage: perPage,
4546
populate: populate

api/controllers/TweetController.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,3 @@ module.exports = {
4545
}
4646

4747
};
48-

config/http.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ module.exports.http = {
4343
'session',
4444
'passportInit',
4545
'myRequestLogger',
46+
'delay',
4647
'bodyParser',
4748
'handleBodyParserError',
4849
'compress',
@@ -54,7 +55,7 @@ module.exports.http = {
5455
'favicon',
5556
'404',
5657
'500'
57-
]
58+
],
5859

5960
/****************************************************************************
6061
* *
@@ -65,7 +66,17 @@ module.exports.http = {
6566
// myRequestLogger: function (req, res, next) {
6667
// console.log("Requested :: ", req.method, req.url);
6768
// return next();
68-
// }
69+
// },
70+
71+
delay: function (req, res, next) {
72+
if (req.method === 'OPTIONS') {
73+
return next();
74+
}
75+
76+
setTimeout(function() {
77+
next();
78+
}, 500);
79+
}
6980

7081

7182
/***************************************************************************

0 commit comments

Comments
 (0)