Tuesday 10 April 2012

ASP.NET Web API (Beta)

I have been recently looking into the new ASP.NET Web API to find out what features it offers and it's quite interesting. It seems to following a convention over code model similar to that of ASP.NET MVC, so for those familiar with those constructs it should be an easy API to follow. You use the global.asax.cs file to name your routes (just like ASP.NET MVC), however you use the MapHttpRoute overload instead e.g. routes.MapHttpRoute( name: "DefaultApi", routeTemplate: "{controller}/notifications" ); This is a typical route where the {controller} template representes the controller name that is found beneath the controllers folder.