Created
January 19, 2013 21:15
-
-
Save xjamundx/4575184 to your computer and use it in GitHub Desktop.
Versioned Route Example
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
| // 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