After reading and watching some of the stuff coming out from Apigee about API Design, I've been convinced that APIs should probably be versioned in the URL using a scheme like this:
By the time I realized this the API I had been building with node.js was basically already complete, so I was a little bit sad that I'd have to come up with some complicated versioning scheme.
After a bit of fretting I realized that express can handle this super easy using an interesting feature of the express() instance that it can be mounted to another route using app.use().
This means that your routes don't know which version they are!
Here's your main app file.
Then you'll put each version of your API in the routes/ folder named after the version.
Each version of the API can have middleware (such as unique authentication) that only works on that version of the API.
One thing that this doesn't cover is unique models per version, but I'll leave that up to you to figure out how to accomplish, because the needs of each app very quite a bit by app.
Hope this tip helps!
IntroductionJSConf has a pretty great reputation. Node.js, Phonegap and other huge projects were announced in JSConf's past. There are legendary parties and fantastic speakers. This year was no exception. As such, the 250 conference tickets sold out in less than 5 minutes. We dressed up like cowboys, rode a mechanical bull and even had shoot-outs. It was a pretty awesome adventure.
ThemesI try to look for themes in the talks that I saw to figure out what's going on in the community right now. Other than the cowboy theme there were a couple of ideas I heard repeated more than once:
- Experimentation / play leads to great ideas.
- Everyone is working really hard to make JS faster.
- We need more women/diversity in JS.
- Build tools / dependencies let us do cooler things.
My TalkI gave a quick talk about some things I think are important to the JS community.
- Open Source
- Respecting Diversity
- Helping New People
- Startup/DIY Culture