My question is not about best practices for REST API URI design.
I've decided for myself, that i'm going to use the following approach:
I'm much more curious about how to design the actual sourcecode in advance to easily extend the API with more versions.
Let's assume we've used a classic MVC-Framework for your favorite programming language.
Our API works fine but we want to add & change functionality that is not backwards compatible. We did think about a nice URI design, but didn't think how our code should look in order to work nicely with different API versions. Crap.. What now?
Question: How should the source code for a versionable REST API look like?
Nice to have:
- Not mixing up the different versions
- Still best use of DRY
- Don't reinvent the wheel over again
- will be extended
Possible answers i can think of:
- Same project - different Namespaces & Subfolders
Namespace: namespace App\Http\Controllers\v1\Users;
Folder: {root_folder}\app\Http\Controllers\v1\Users\UserLoginController.php
- Different projects
Point http://ift.tt/1Pmaxj8
to project 1
and http://ift.tt/1kspog0
to project 2
Aucun commentaire:
Enregistrer un commentaire