this is probably daft in many ways but I’m just starting with MVC as the asp .net web api looks really interesting.
Just thinking can a ‘web api’ also serve as a front end internet application? I’m guessing that the answer is ‘no’ but it could save lots of time to somehow get the API working with the front-end in the same place, what’s the other option – create 1 project for the API and an another for the front end?
Since MVC separates the view from the business logic and uses REST for data retrieval, you can build a MVC application and then just document the API standard for how other applications can interface with your application.
For example, your application has a view called Gadgets. Behind the scenes the view is really calling http://myapplication.com/gadgets/1 to get the first page of available gadgets and then loops through them to display the data in html format to the browser. In reality since http://myapplication.com/gadgets/1 should always return the first page of gadgets, you can say in your API documentation that calling http://myapplication.com/gadgets/1 returns the first page of gadgets. If I am the calling application then all I have to do then is call this url and parse out the result for display.
This is the beauty of MVC if you implement it correctly.