Skip to content

Instantly share code, notes, and snippets.

@hokaccha
Forked from tj/routes.js
Created October 15, 2011 02:32
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hokaccha/1288919 to your computer and use it in GitHub Desktop.
Save hokaccha/1288919 to your computer and use it in GitHub Desktop.
Express routes
var app = require('../app');
var colors = require('colors');
function format(method) {
switch (method) {
case 'get': return 'GET '.grey;
case 'post': return 'POST '.cyan;
case 'put': return 'PUT '.green;
case 'delete': return 'DELETE '.magenta;
default: return method.toUpperCase();
}
}
console.log();
app.routes.all()
.sort(function(a, b) {
if (a.path === b.path) return 0;
return a.path > b.path ? 1 : -1;
})
.forEach(function(route){
console.log(route.method, route.path);
});
console.log();
process.exit();
GET /:path(*).js
GET /my/videos
GET /my/videos/:page
GET /
GET /search
GET /explore/all
GET /explore/all/:page
GET /subject/:id
GET /subject/:id/:page
GET /video/:slug
GET /create
GET /uploads/images/:name
POST /like/:id
POST /unlike/:id
POST /login
POST /signup
POST /video/:id
POST /video
POST /upload/image
PUT /video/:id/private
PUT /video/:id/public
DELETE /video/:id
DELETE /video/data
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment