mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	Instead of instructing users to do static calls in to Unleash, she should instead be allwed to specify the log provider as an option to Unleash. This commit introduces the "getLogger" option, a function responsible for creating a logger.
		
			
				
	
	
		
			28 lines
		
	
	
		
			789 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			28 lines
		
	
	
		
			789 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
'use strict';
 | 
						|
 | 
						|
const Controller = require('../controller');
 | 
						|
const FeatureController = require('./feature.js');
 | 
						|
const MetricsController = require('./metrics.js');
 | 
						|
const RegisterController = require('./register.js');
 | 
						|
const apiDef = require('./api-def.json');
 | 
						|
 | 
						|
class ClientApi extends Controller {
 | 
						|
    constructor(config) {
 | 
						|
        super();
 | 
						|
 | 
						|
        const stores = config.stores;
 | 
						|
        const getLogger = config.getLogger;
 | 
						|
 | 
						|
        this.get('/', this.index);
 | 
						|
        this.use('/features', new FeatureController(stores, getLogger).router);
 | 
						|
        this.use('/metrics', new MetricsController(stores, getLogger).router);
 | 
						|
        this.use('/register', new RegisterController(stores, getLogger).router);
 | 
						|
    }
 | 
						|
 | 
						|
    index(req, res) {
 | 
						|
        res.json(apiDef);
 | 
						|
    }
 | 
						|
}
 | 
						|
 | 
						|
module.exports = ClientApi;
 |