mirror of
https://github.com/strapi/strapi.git
synced 2025-07-13 12:02:10 +00:00
40 lines
550 B
JavaScript
40 lines
550 B
JavaScript
![]() |
'use strict';
|
||
|
|
||
|
/**
|
||
|
* Module dependencies
|
||
|
*/
|
||
|
|
||
|
// Node.js core.
|
||
|
const path = require('path');
|
||
|
|
||
|
/**
|
||
|
* Public assets hook
|
||
|
*/
|
||
|
|
||
|
module.exports = function (strapi) {
|
||
|
const hook = {
|
||
|
|
||
|
/**
|
||
|
* Default options
|
||
|
*/
|
||
|
|
||
|
defaults: {
|
||
|
static: true
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* Initialize the hook
|
||
|
*/
|
||
|
|
||
|
initialize: function (cb) {
|
||
|
if (strapi.config.static === true) {
|
||
|
strapi.app.use(strapi.middlewares.static(path.resolve(strapi.config.appPath, strapi.config.paths.static)));
|
||
|
}
|
||
|
|
||
|
cb();
|
||
|
}
|
||
|
};
|
||
|
|
||
|
return hook;
|
||
|
};
|