1 | module.exports = function(app) {
|
2 | ;
|
3 |
|
4 | var getAPI = {
|
5 | routes: function() {
|
6 | var routes = [],
|
7 | methods = ['get', 'post', 'put', 'delete'];
|
8 |
|
9 | methods.forEach(function(m) {
|
10 | if (app.routes[m]) {
|
11 | routes = routes.concat(app.routes[m]);
|
12 | }
|
13 |
|
14 | routes.sort(function(a, b) {
|
15 | return a.path.localeCompare(b.path);
|
16 | });
|
17 | });
|
18 |
|
19 | return routes;
|
20 | }
|
21 | };
|
22 |
|
23 | return getAPI;
|
24 | }; |
\ | No newline at end of file |