A Single Page App With Backbone.js, ASP.NET Web API, and F#
Here's a screenshot of the simple contact list view:
The C# project contains the following:
- A single Index.cshtml file.
- A "Templates" folder that contains 2 .htm files that hold the markup for each view. The templating feature of underscore.js is used to allow placeholders in the templates to be replaced with the desired data.
- The "app" folder contains a main.js, a utility.js, and a file containing route definitions using Backbone.Router.
- The "models" folder contains the Backbone models and collections.
- The "views" folder contains Backbone views.
The F# project contains the following:
- ASP.NET MVC and Web API routes.
- Definitions of JS and CSS bundles.
- ASP.NET MVC and Web API Controllers.
- A Model class.
You can find the full source at https://github.com/dmohl/FsWebSpa-Backbone.
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)