Last active
August 29, 2015 13:58
-
-
Save scarney81/9955522 to your computer and use it in GitHub Desktop.
Output API routes to console
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
'use strict'; | |
var _ = require('underscore'), | |
routes = require('./routes'), | |
log = function (method) { | |
return function (route) { | |
console.log(route + ' -- ' + method); | |
}; | |
}, | |
app = { | |
get: log('GET'), | |
post: log('POST'), | |
put: log('PUT'), | |
'delete': log('DELETE') | |
}; | |
function parseRoute(route) { | |
if (_.isFunction(route)) { | |
route(app); | |
} else if (_.isObject(route)) { | |
_.each(route, parseRoute); | |
} | |
} | |
_.each(routes, parseRoute); | |
process.exit(); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment