Preface

Created in 1995 by Brendan Eich of Netscape, JavaScript has gone from being a toy scripting language used only in browsers to being one of the most popular languages in the world for full-stack development. With the introduction of Node.js, built on top of Chrome’s V8 JavaScript Engine, developers are now able to build powerful and performant applications using JavaScript. With the addition of MongoDB, a modern NoSQL database, applications can utilize JavaScript at every tier.

Many popular web applications are implemented, partially or in whole, as single-page applications, or SPAs. With SPAs, users load a single web page, and that page is updated dynamically in response to user interaction or incoming server data. The advantage is an application experience that is smoother, replicates native application interaction, and may require less network traffic and server load.

The MEAN stack is a set of JavaScript tools representing a full stack, from database to runtime environment, application framework, and frontend. This book provides a thorough background in building SPAs using the MEAN stack and other tools in the JavaScript ecosystem. It covers the basics of SPA architecture and JavaScript tools. The book then expands to more advanced topics, such as building, securing, and deploying an SPA built with the MEAN stack.

What this book covers

Chapter 1, Getting Organized NPM, Bower, and Grunt, introduces JavaScript frontend package-management, build, and task-running tools. These tools form the foundation for you to set up an ideal development environment.

Chapter 2, Model-View-Whatever, goes beyond the original MVC design pattern and explores its translation into frontend frameworks and its evolution into Model-View-*, or Model-View-Whatever (MVW), in which the Controller layer is more open ended and often abstracted into other layers more suited to an SPA environment.

Chapter 3, SPA Essentials - Creating the Ideal Application Environment, introduces you to the common components/layers of an SPA, the best practices and variations around these components, and how to put them together and lay the groundwork for a modern SPA.

Chapter 4, REST is Best - Interacting with the Server Side of Your Application, goes into further detail about the server side of SPA architecture—in particular, with regard to the REST (representational state transfer) architectural pattern. You’ll become familiar with different methods to interact with a REST API using JavaScript and AJAX, with practical examples.

Chapter 5, Its All About the View, focuses on the concept of views in the SPA architecture and how views can be initialized in a single-page container. It discusses JavaScript templates and provides examples from different libraries, going deeper into how AngularJS views are implemented.

Chapter 6, Data Binding, and Why You Should Embrace It, teaches you about data binding, describes one-way versus two-way data binding, and discusses the practicality of data binding in an SPA and why you should use it. You will also cover the continual evolution of the ECMAScript/JavaScript standard and how it now supports native data binding in some clients.

Chapter 7, Leveraging the MEAN Stack, introduces you to the MEAN stack (MongoDB, Express, AngularJS, and Node.js) and how they work together. You will install and configure MongoDB and Node.js and explore working with each on the command line. You’ll create a database for a new SPA and learn about AngularJS and Express, the two other pieces of the stack.

Chapter 8, Manage Data Using MongoDB, teaches you how to create and manage databases in MongoDB. Using the command line, you will execute CRUD (create, read, update, and delete) functions.

Chapter 9, Handling Web Requests with Express, familiarizes you with the Express routing middleware and handling requests from and responses to the browser. After configuring the Express router, you’ll create a number of routes, which return dynamically generated data to the web browser when requested, organize your routes logically, and handle POST requests from forms.

Chapter 10, Displaying Views, explores combining dynamic view rendering in Express along with AngularJS. You will configure the Express application to use EJS (Embedded JavaScript) templates and use Bootstrap for basic styling.

Chapter 11, Adding Security and Authentication, teaches you how to secure the Express-based SPA by preventing common exploits such as cross-site request forgery (CSRF). You will install passport-authentication middleware for Node.js and configure it for local authentication and set up session management.

Chapter 12, Connecting the App to Social Media, extends the SPA by connecting it to multiple social media platforms. You will set up passport authentication using Facebook and Twitter strategies and share data from the SPA.

Chapter 13, Testing with Mocha, Karma, and More, teaches you testing, both on the server side and in the view.

Chapter 14, Deploying and Scaling the SPA, walks you through setting up a production database on MongoLab and deploying your SPA to Heroku. Finally, you will explore scaling your SPA in the cloud.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.22.74.160