This book was written to give you an introductory look at what it takes to create a single-page application. The book not only introduces you to frameworks and technologies for creating an SPA but also shows you how to unit test them and how to automate client-side development and build-related tasks.
Because part of the process of creating an SPA is deciding what your technology stack will look like, the book compares various approaches used by today’s leading JavaScript frameworks. One of the reasons why so many frameworks exist is that there’s no single correct way to build an application. By comparing different frameworks, you can better decide what’s right for you and your next project.
Each chapter of the book includes a complete, working application. I’ve tried to keep things interesting yet not overwhelming. I’m not a fan of long-running examples that fill half a book with pages and pages of source code to wade through. So I decided to create a separate project for each chapter. I also tried to keep each example as small and to the point as possible while still being interesting and relevant to the concepts and topics for the chapter.
Part 1: The basics
Part 2: Core concepts
The appendices are meant to complement the chapters. Appendix A is a walk-through of the complete source code for all three versions of the project for chapter 2. Appendix B and appendix C complement chapter 7. Appendix B is an overview of the XMLHttpRequest API, and appendix C is a summary of the server-side calls for the chapter’s project. Although the chapter is written deliberately so that you can use the server-side language of your choice, appendix C additionally includes a guide to the Spring MVC code that was used in the downloadable source. Appendix D is a simple guide for installing Node.js and Gulp.js, which you’ll need if you want to try out the code for chapter 9.
This book assumes you have at least basic knowledge of JavaScript, HTML, and CSS. It’s also helpful if you have some level of web development experience, although this isn’t a requirement. This book does, however, target those who have little or no experience in the development of single-page applications or have created SPAs but not using the technologies described in this book.
Source code in listings or in text appears in a fixed-width font like this to separate it from ordinary text. Code annotations accompany the listings, highlighting important concepts.
Source code for the examples in this book can be downloaded from the publisher’s website at www.manning.com/books/spa-design-and-architecture.
If you’re using a recent Mac OS X or Windows computer and a modern browser (for example, Firefox, Safari, or Chrome), you should have no trouble with any of the examples. For any special software requirements, you’ll find directions in the chapter/appendix itself.
Because most of the examples dynamically fetch HTML files, you may need to set certain privileges in your browser if you’re running the example locally (versus using a server). Please see the readme.txt file in the downloadable source for the project for details.
If you want to try the example for chapter 7, you’ll need to use some type of server and some type of server-side language. Everyone has their preferences, so it’s left to you to decide what you want to use. I used Java/Spring MVC and include a mini guide to getting that set up. If you’re using something else, I describe the server-side calls and objects conceptually so you can re-create them using the technology of your choice.
Purchase of SPA Design and Architecture includes free access to a private web forum run by Manning Publications where you can make comments about the book, ask technical questions, and receive help from the author and from other users. To access the forum and subscribe to it, please go to www.manning.com/books/spa-design-and-architecture. This page provides information on how to get on the forum once you’ve registered, what kind of help is available, and the rules of conduct on the forum.
Manning’s commitment to our readers is to provide a venue where a meaningful dialog between individual readers and between readers and the author can take place. It’s not a commitment to any specific amount of participation on the part of the authors whose contribution to the Author Online forum remains voluntary (and unpaid). We suggest you try asking the author some challenging questions lest his interest stray!
The Author Online forum and the archives of previous discussions will be accessible from the publisher’s website as long as the book is in print.
Emmit Scott is a senior software engineer and architect with more than 17 years of experience in creating web-based applications. He’s developed large-scale applications for education, banking, and telecommunications. His hobbies include reading (especially Jim Butcher novels), playing the guitar (was a head banger back in the day), and spending as much time as possible with his children.