Introduction to Single Page Apps ... with Ruby
John Papa's "Single Page Apps JumpStart " course is a great way to learn how to build SPAs (single-page applications). He takes you from zero to a multi-screen full CRUD application called Code Camper JumpStart (CCJS) explaining every step along the way.
We've secretly replaced the Web API and Entity Framework used to power the backend of his app with Ruby on Rails. Let's see if he'll notice.
We'd encourage you to:
- Download the CCJS-Ruby source code and run the app yourself.
- Read What Breeze can do for you on John's blog along with the 50+ comments from other developers.
- Take the Single Page Apps JumpStart course on PluralSight (requires subscription, but they have a free trial).
- Flip through slides from Ward's Bay.NET presentation, Breeze, Data, and the Single Page App. We'llbe turning this into a video soon.
- Watch the video.
The backend is significantly different, as we've replaced Web API, EF, and SQL Server and are using a simple Ruby on Rails application that saves data to a MySQL database instead.
Changes to the client-side of the app are minor.
- Updated Breeze to the latest version
- Reconfigured the server host
- Added a Breeze-AJAX request interceptor
- Added an Active Record data service adaptor
Changes to the server-side of the app are where things got interesting though:
rails/app/controllers contains the three controllers that are used to respond to client requests. Requests routing is configured in config/routes.rb.
Contains the CRUD methods used to manage the sessions. The client uses this controller to get session information and create , update, and delete sessions.
Uses a single method to get speaker info.
Includes the methods used to get metadata and lookup info.
rails/app/models holds the models that hold the business model for the application. There are 6 files that model the data mapping, the relationships between data objects and operations on data objects
rails/app/views holds the views used to define the API responses.
John will be the first to tell you that Breeze eliminates the need for many files and hundreds of lines of code. His experience of writing the data layer by hand helped him choose Breeze for his second course on SPA. See what you think.