I'm building SPA
application using Backbone.js
and as its back-end
I want to use ASP.NET Web API
. I need only one page and this fact brings me a lot of confusion.
ApiController
returns json
response and as far as I understand there's no need in asp.net
-specific views at all. Am I right?
Can I use plain html for my main page? Or should I use *.cshtml
and put a call to RenderBody
instead?
If choose the first option then how will I handle validation?
Thanks!
Well the trick is that if you want search engines to be able to index your page, or people to be able to share to Facebook with a custom icon/description, etc you'll need to serve back static HTML -- none of those bots are able to run your javascript to render the page as the browser does.
If you're uninterested in this, then yes, you can completely avoid RenderBody
.