index.js
function endpoint(options) {
	// find the middlewares
	options.permissions = options.permissions || ['null'];
	options.middlewares = options.middlewares || [];
	options.middlewares.unshift([permissioner(options.permissions)]);

	for (var i = 0, length = options.methods.length; i < length; i++) {
		var method = options.methods[i].toLowerCase();
		reqlog.log('setup endpoint', method + ' ' + options.url);

		router[method](options.url, options.middlewares,
		function(req, res) {
			routerCallback(req, res, options.callback);
		});
	}
}
function endpoint(options) {
	// find the middlewares
	options.permissions = options.permissions || ['null'];
	options.middlewares = options.middlewares || [];
	options.middlewares.unshift([permissioner(options.permissions)]);

	for (var i = 0, length = options.methods.length; i < length; i++) {
		var method = options.methods[i].toLowerCase();
		reqlog.log('setup endpoint', method + ' ' + options.url);

		router[method](options.url, options.middlewares,
		function(req, res) {
			routerCallback(req, res, options.callback);
		});
	}
}
function endpoint ( options ) { // find the middlewares options . permissions = options . permissions || [ 'null' ] ; options . middlewares = options . middlewares || [ ] ; options . middlewares . unshift ( [ permissioner ( options . permissions ) ] ) ; for ( var i = 0 , length = options . methods . length ; i < length ; i ++ ) { var method = options . methods [ i ] . toLowerCase ( ) ; reqlog . log ( 'setup endpoint' , method + ' ' + options . url ) ; router [ method ] ( options . url , options . middlewares , function ( req , res ) { routerCallback ( req , res , options . callback ) ; } ) ; } }
Create an endpoint
@method endpoint
@param  {object}   options  It contains the following options
methods: Array. Can contain 'post', 'get', 'delete', 'put'
url: String. The matching url e.g. /users, /users/:id/update
middlewares: Array. The middlewares (functions) that will be called before the callback
permissions: Array (optional). Docs: https://github.com/Knorcedger/apier-permissioner
if no permissions given, 'null' (public service) is assumed
callback: Function. The callback function to execute
Create an endpoint