Learn how to create and use WebApi to provide data to JavaScript SPA apps.
Some notes before we start
WebApi is not directly razor, as it's not meant to actualy render HTML. It's coded using C# just like razor, but won't have commands like @Html.Raw(...)
. Since it's the best way to communicate from the server with your JavaScript apps, we've included the basics in this tutorial.
Our examples use very trivial JavaScript code to call the API and show the results. Your SPA apps will usually be more sophisticated, but that would then be a topic for a JavaScript tutorial.