Skip to content

Instantly share code, notes, and snippets.

@xjamundx
Created January 19, 2013 21:15
Show Gist options
  • Select an option

  • Save xjamundx/4575184 to your computer and use it in GitHub Desktop.

Select an option

Save xjamundx/4575184 to your computer and use it in GitHub Desktop.
Versioned Route Example
// Version 0
var express = require('express');
var contacts = require('../control/contacts')
var customAuth = require('../lib/customAuth')
var app = module.exports = express();
// middleware that only applies to this version of the API
app.use(customAuth());
// normal routes, all will be pre-fixed by the version
app.get('/contacts', contacts.index) // /v0/contacts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment