api.js 752 Bytes
var express = require('express'); 

exports = module.exports = function(IoC,policies){
	var app = this;
	var router= express.Router();
    var controller = IoC.create('controllers/api');
  
	router.get(
		'/*',
		policies.ensureLoggedOut(),
		controller.get
	);

	router.post(
		'/*',
		policies.ensureLoggedOut(),
		controller.post
	); 

	router.put(
		'/*',
		policies.ensureLoggedOut(),
		controller.put
	); 

	router.patch(
		'/*',
		policies.ensureLoggedOut(),
		controller.patch
	);

	router.head(
		'/*',
		policies.ensureLoggedOut(),
		controller.head
	);
	
	router.delete(
		'/*',
		policies.ensureLoggedOut(),
		controller.delete
	);  

	app.use('/api', router);
};

exports['@require']=['$container','policies'];
exports['@singleton']=true;