mirror of
				https://github.com/strapi/strapi.git
				synced 2025-10-31 18:08:11 +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;
 | |
| };
 | 
