You may know that I have been co-authoring a book on ASP.NET Web API for a while now and it is available as an alpha book if you would like to get the early bits and pieces. One of the aim’s of this book is to provide a well-structured resource for ASP.NET Web API and also to give you a hint on how you would go and build a real world application with this super-awesome framework. In order to make our second goal easy, we have dedicated 3 chapters to build a real world HTTP API from scratch for a small city delivery company and we called it PingYourPackage. These three chapters will be covering the application structure, building the data layer, building and testing the core API layer, creating the .NET wrapper around this API and consuming this through an ASP.NET MVC 4 web application.
Although the writing process for those chapters are still not completed, we wanted to give you an early glimpse on the sample application and the source code of the project is now up on GitHub.
If you are not familiar with GitHub and Git, I recommend watching the Phil Haack’s talk on Git and GitHub for Developers on Windows and its more hardcore version from Keith Dahlby: Git More Done.
After cloning the source code, you can either directly build the project through the Visual Studio 2012 (or Web Developer Express) or you can run the build script. You can open up the entire solution by double clicking the PingYourPackage.sln file and build it from there.
To run the build script, open up a PowerShell console and make sure your execution policy is not restricted. When you run the .\scripts\build.ps1 script, it will install the missing NuGet packages, build the entire application and runs the unit/integration tests. The output will be put under .\artifacts folder.
As mentioned, it’s not completely done yet but the server level code is complete. The .NET wrapper and web client will be there so soon.