I am fiddeling with the new wep api in mvc 4 beta and adding some new api controllers to my existing mvc site. Problem is I can’t name the web api controllers the same as my existing controllers. For now I have given them names like ProductApiController but that is not very restlike. What is a good strategy for namegiving of these new controllers when adding them to an existing mvc site?
Share
You could have your API controllers with the same name as your existing controllers. Just put them in a different namespace to make the compiler happy.
Example:
and the API controller:
and then you have:
/productsand/api/productsrespectively to work with.