我已经在 NodeJs Connect-rest中编写了一个 REST API,我想知道如何存储上次调用的日期和时间。
这是 GET url 调用
http://localhost:8080/api/books/metadata?id=12
过滤此 ID 的代码片段
module.exports.getItem = function(callback, id) {
var searchLetter = new RegExp(id, 'i');
//would like to record date/time the last time this call was made to this ID/row
//return the date/time back in the callback method
var row = items.filter(function(itemList) {
return searchLetter.test(itemList.asname);
});
return callback(null, {items: row, matches: row.length}, {headers: {'Content-type': 'application/json'}});
};