By Joshua Johanan
This e-book may help you become familiar with Node.js and enforce the data to construct effective internet purposes. you begin with constructing a backend internet program by way of a frontend interface, and afterward installation it to the cloud platform. This ebook takes a holistic method of server-side programming utilizing Node.js at the side of varied frameworks and instruments.
Read or Download Building Scalable Apps with Redis and Node.js PDF
Approximately This Book
Understand how net 2. zero is made by means of strong browser-based applications
Step-by-step educational that may exhibit you the way speedy, complicated net functions should be built
Who This ebook Is For
This ebook relies on Meteor 1. zero.
- Start Here! Learn HTML5
- Dart 1 for Everyone: Fast, Flexible, Structured Code for the Modern Web
Additional resources for Building Scalable Apps with Redis and Node.js
If you want to change this, just add the port number as the last parameter, as shown in the following command line: $ python -m SimpleHTTPServer 8080 Python is a great glue language. It has a great standard library that allows you to build small scripts that do a lot. We will just use the default port for now. Point your browser to http://localhost:8000, and you should see your blank page.
Our little app works, well kind of. It is still a little clunky and missing some polish, and in addition to that, there is no way to log out. user; }; [ 38 ] Chapter 1 A simple logOut function for a simple auth system. We have set isAuthenticated on the session back to false and got rid of the user in the session. js present in the routes folder. redirect('/'); }; We log the user out, and then redirect to root. Finally, it needs to be added to our routes. js. logOut); After logging in, we can log ourselves out by going to http://localhost:3000/ logout.
Js file. js. This is not very maintainable. As a simple example, what if our cookie secret changes? What happens when we only update one of the references to the cookie secret? Let's say our app grows and the secret is referenced in two other middleware. This will create a lot of pain and waste time tracking down weird bugs in the code. What we need is a config file to store all the application's settings. exports = config; We are creating an object and then returning it when this file is required.