I am Hack Sparrow
Captain of the Internets.

Express.js HTTPS

Setting up a HTTPS Express.js server is pretty easy and straightforward. First you need to make sure you have a signed SSL certificate for your server. In case you don't have one, you can create one for yourself this way: [code] $ openssl genrsa -out hacksparrow-key.pem 1024 $ openssl req -new -key hacksparrow-key.pem -out certrequest.csr $ openssl x509 -req -in certrequest.csr -signkey hacksparrow-key.pem -out hacksparrow-cert.pem [/co ...

Node.js HTTPS – SSL Certificate

Need to use HTTPS for a project? Or just wondering how easy or tough it is to implement HTTPS in Node.js? In this post I'll show you how to set up an HTTPS Node.js server on your local system. First off, we'll need to create a SSL certificate for our server. The recommended way is to get your certificate signed by a Certificate Authority, but for testing purposes we will sign it o ...

POST / GET Request Handling in Node.js Express

URL and forms processing are two of the many factors that make the Web the dynamic and useful platform it is. Any server-side technology that is worth it's salt should implement ways to handle the HTTP GET and POST request efficiently. Let's find out how to handle GET and POST requests in the Node.js Web framework Express.js with some examples. HTML GET form: [code] <form method= ...

Sessions in Express.js (Node.js Web Framework)

[notice] For a more elaborate and updated tutorial on sessions in Express, visit http://expressjs-book.com/forums/topic/express-js-sessions-a-detailed-tutorial/. [/notice] Wondering if Node.js Web servers supports sessions? It is a breeze if you use the Express.js Web framework. I will guide you through the proces ...

Use RedisStore instead of MemoryStore – Express.js in Production

After setting the NODE_ENV environment variable to 'production', when you try to run your Express.js app with sessions support, you will be hit by this: [code] Warning: connection.session() MemoryStore is not designed for a production environment, as it will leak memory, and obviously only work within a single process. [/code] What it means is that the MemoryStore module used for managing sessions is not meant for production. So what do you do about it? Use ...