𝔖 Scriptorium
✦   LIBER   ✦

📁

Building Scalable Apps with Redis and Node.js

✍ Scribed by Joshua Johanan


Publisher
Packt Publishing
Year
2014
Tongue
English
Leaves
316
Category
Library

⬇  Acquire This Volume

No coin nor oath required. For personal study only.

✦ Synopsis


Develop customized, scalable web apps through the integration of powerful Node.js frameworks

About This Book

  • Design a simple application and turn it into the next Instagram
  • Integrate utilities such as Redis, Socket.io, and Backbone to create Node.js web applications
  • Learn to develop a complete web application right from the frontend to the backend in a streamlined manner

Who This Book Is For

If the phrase scalability sounds alien to you, then this is an ideal book for you. You will not need much Node.js experience as each framework is demonstrated in a way that requires no previous knowledge of the framework. You will be building scalable Node.js applications in no time! Knowledge of JavaScript is required.

What You Will Learn

  • Build and implement your custom middleware for Express
  • Integrate Socket.IO with Express and use the same authentication
  • Create a secure local store for passwords
  • Use message queues to break down your application into manageable pieces
  • Leverage the power of Redis to create a shared state across many different servers
  • Implement Backbone, Socket.IO, and React together for a fast, dynamic, and real-time frontend
  • Automate your build process with the use of the Grunt.js task runner
  • Build deployment scripts to get servers running your application in the cloud

In Detail

Node.js is a JavaScript runtime-based, scalable platform used to develop web applications and network programs on the server side. It allows web designers to access the backend of their projects while also allowing developers, who are willing to learn JavaScript, a chance to design. There are many frameworks that have popped up in recent years, but what makes Node.js unique is that it opens up a whole new frontier for web development and takes a hybrid approach.

This book will help you get to grips with Node.js and implement the knowledge to build efficient web applications. You start with developing a backend web application followed by a frontend interface, and later on deploy it to the cloud platform. This book takes a holistic approach to server-side programming using Node.js in conjunction with different frameworks and tools.

✦ Table of Contents


Cover
Copyright
Credits
About the Author
About the Reviewers
www.PacktPub.com
Table of Contents
Preface
Chapter 1: Backend Development with Express
Node.js and Node Package Manager
Using Express in Node
Using middleware in Express
Creating our own middleware
Adding templates to the mix
Layouts
Using sessions in Express
Using cookies in Express
Adding sessions
Redis as a session store
Processing forms
Cross-Site Request Forgery (CSRF)
Very simple authentication
Setting up a config file for our app
Route mapping
Updating our app to use the config
Methods to extend an application
Summary
Chapter 2: Extending Our Development with Socket.IO
Node package versions
Building a simple Socket.io app
Installing the package
Building the client
Using Python to serve our site
Ping-Pong
Creating some interaction
Adding the browser side
Acknowledgments
Broadcasting a message
Using the disconnect event
Creating namespaces
Building our namespace client
Adding rooms
Using namespaces or rooms
Namespaces
Finding namespaces
When to use rooms
Finding rooms
Using namespaces and rooms together
Using Socket.io and Express together
Adding Socket.io to the config
Who are you?
Authorization in Socket.io
Adding application-specific events
Using Redis as the store for Socket.io
Socket.io inner workings
WebSockets
Ideas to take away from this chapter
Summary
Chapter 3: Authenticating Users
Node package versions
Let's build our authentication
Registering a Facebook application
Using Passport to authenticate to Facebook
Using Google for authentication
Adding Google authentication to
our application
Adding more OAuth providers
Adding secure local authentication
Adding registration
Adding a database
Password-storing theory
OAuth process
Summary
Chapter 4: RabbitMQ for Message Queuing
Node package versions
Getting RabbitMQ
Installing on Mac OS X
The RabbitMQ management plugin
Installing on Linux
Installing on Windows
Our first message queue
Using the management interface
Sending messages
Queuing messages
Adding another worker
Sending messages back
Creating StartServer
Building the worker
Charging cards in real-time
Adding message queues to PacktChat
Topic exchange
Building the worker
Message queuing in RabbitMQ
Summary
Chapter 5: Adopting Redis for Application Data
Node package versions
Installing Redis
Installing on Mac OS X
Installing on Linux
Installing on Windows
Using Redis data structures
Building a simple Redis application
Redis schema
Using a hash
Keys in Redis
Redis persistence
Removing Redis keys
Using Redis as a message queue
Adding Redis to PacktChat
Defining the Redis structures
Creating our Redis functions
Redis is for application state
Summary
Chapter 6: Using Bower to Manage Our Frontend Dependencies
Node package versions
Installing and using Bower
Introducing React
Introducing Backbone
Using Backbone models
Using Backbone collections
Summary
Chapter 7: Using Backbone and React for DOM Events
Bower package versions
Finishing Socket.IO
Creating React components
React summary
Backbone models
Syncing the models with Socket.IO
Creating the model
Creating collections
The Backbone router
Putting it all together
Updating CSS and the layout
Adding a new worker
Trying out our application
Summary
Chapter 8: JavaScript Best Practices for Application Development
Node package versions
Setting up tests
Using Istanbul for code coverage
Setting up different environments
Twelve Factor App
Fixing the config file
Creating our environment files
Adding more environments
Introducing Grunt
Building a basic Grunt file
Automating our tests
Preprocessing our files
Using Grunt to clean out a folder
JSHinting our source files
Concatenating our code
Minifying our code
Grunt summary
Static files and CDNs
Creating an S3 bucket
Python and installing virtual environments
Scripting our new tools
Summary
Chapter 9: Deployment and Scalability
Creating servers on EC2
AWS EC2 summary
What is Ansible?
Installing Ansible
Using Ansible roles
Installing RabbitMQ
Installing our application
Installing the workers
Load balancing multiple application servers
Automating roles
A summary of Ansible
Creating new environments
Scalability
Different types of scalability
Horizontal
Vertical
Summary
Chapter 10: Debugging and Troubleshooting
Node packages
Using Chrome Developer Tools
Elements
Network
Sources
Timeline
Profiles
Resources
Audits
Console
Inspecting requests
Debugging
Frontend debugging
Backend debugging
Debugging summary
CPU profiling our application
Taking heap snapshots
Frontend memory leaks
Memory leak summary
Summary
Index


📜 SIMILAR VOLUMES


Building Scalable Apps with Redis and No
✍ Johanan Joshua. 📂 Library 🌐 English

Packt Publishing, 2014. — Code only. — ISBN-10: 1783984481, ISBN-13: 978-1-78398-448-0.<div class="bb-sep"></div><strong>Код примеров к выложенной здесь книге в формате PDF, EPUB, MOBI, AZW3.</strong><br/> <br/>Node.js is a JavaScript runtime-based, scalable platform used to develop web applications

Building Scalable Apps with Redis and No
✍ Johanan Joshua. 📂 Library 🌐 English

Packt Publishing, 2014. — 293 p. — ISBN-10: 1783984481, ISBN-13: 978-1-78398-448-0.<br/> <br/><strong>Код примеров к книге выложен <a class="object-link fpm" data-file-id="1938518" href="/file/1938518/">здесь</a>.</strong><br/> <br/>Node.js is a JavaScript runtime-based, scalable platform used to de

Building Scalable Apps with Redis and No
✍ Johanan Joshua. 📂 Library 🌐 English

Packt Publishing, 2014. — 293 p. — ISBN-10: 1783984481, ISBN-13: 978-1-78398-448-0.<br/> <br/><strong>Код примеров к книге выложен <a class="object-link fpm" data-file-id="1938518" href="/file/1938518/">здесь</a>.</strong><br/> <br/>Node.js is a JavaScript runtime-based, scalable platform used to de

Building Scalable Apps with Redis and No
✍ Johanan Joshua. 📂 Library 🌐 English

Packt Publishing, 2014. — 293 p. — ISBN-10: 1783984481, ISBN-13: 978-1-78398-448-0.<br/> <br/><strong>Код примеров к книге выложен <a class="object-link fpm" data-file-id="1938518" href="/file/1938518/">здесь</a>.</strong><br/> <br/>Node.js is a JavaScript runtime-based, scalable platform used to de