ebook img

Building Scalable Apps with Redis and Node.js PDF

474 Pages·2014·4.26 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Building Scalable Apps with Redis and Node.js

Building Scalable Apps with Redis and Node.js Table of Contents Building Scalable Apps with Redis and Node.js Credits About the Author About the Reviewers www.PacktPub.com Support files, eBooks, discount offers, and more Why subscribe? Free access for Packt account holders Preface What this book covers What you need for this book Who this book is for Conventions Reader feedback Customer support Downloading the example code Downloading the color images of this book Errata Piracy Questions 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 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 Using the authorization handler Cookies and sessions Getting the session 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 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 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 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 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 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 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 9. Deployment and Scalability Creating servers on EC2 AWS EC2 summary What is Ansible? Installing Ansible Using Ansible roles Installing RabbitMQ Installing our application Deploying the code 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 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

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.