mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-11-03 20:45:58 +01:00 
			
		
		
		
	plugins - added api routes to filter:admin.create_routes
This commit is contained in:
		@@ -244,7 +244,7 @@ var nconf = require('nconf'),
 | 
			
		||||
 | 
			
		||||
		var custom_routes = {
 | 
			
		||||
			'routes': [],
 | 
			
		||||
			'api_methods': []
 | 
			
		||||
			'api': []
 | 
			
		||||
		};
 | 
			
		||||
 | 
			
		||||
		plugins.ready(function() {
 | 
			
		||||
@@ -264,6 +264,19 @@ var nconf = require('nconf'),
 | 
			
		||||
						}(route));
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
				var apiRoutes = custom_routes.api;
 | 
			
		||||
				for (var route in apiRoutes) {
 | 
			
		||||
					if (apiRoutes.hasOwnProperty(route)) {
 | 
			
		||||
						(function(route) {
 | 
			
		||||
							app[apiRoutes[route].method || 'get']('/admin/api' + apiRoutes[route].route, function(req, res) {
 | 
			
		||||
								apiRoutes[route].callback(req, res, function(data) {
 | 
			
		||||
									res.json(data);
 | 
			
		||||
								});
 | 
			
		||||
							});
 | 
			
		||||
						}(route));
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
			});
 | 
			
		||||
		});
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user