mirror of
https://github.com/strapi/strapi.git
synced 2025-07-13 03:51:54 +00:00
33 lines
427 B
JavaScript
33 lines
427 B
JavaScript
'use strict';
|
|
|
|
/**
|
|
* X-Response-Time hook
|
|
*/
|
|
|
|
module.exports = function (strapi) {
|
|
const hook = {
|
|
|
|
/**
|
|
* Default options
|
|
*/
|
|
|
|
defaults: {
|
|
responseTime: true
|
|
},
|
|
|
|
/**
|
|
* Initialize the hook
|
|
*/
|
|
|
|
initialize: function (cb) {
|
|
if (strapi.config.responseTime === true) {
|
|
strapi.app.use(strapi.middlewares.responseTime());
|
|
}
|
|
|
|
cb();
|
|
}
|
|
};
|
|
|
|
return hook;
|
|
};
|