I am Hack Sparrow
Captain of the Internets.

Archive for Express.js

How to Write Middleware for Connect / Express.js

If have reached to the point of wanting to write your own Express.js middleware, probably you know that Express.js is actually Connect (with additional features). If you didn't know that already, probably you should take it easy and learn more about Connect first. If you know what Connect is and want to write a middleware for it, you have come to the right place. Also I will show you ho ...

Express.js Tutorial

Looking for a good tutorial on Express.js to help you get quickly productive in it? You have come to the right place. [notice] This tutorial is for Express 3, the current version is Express 4. Unless you want to use Express 3, consider the tutorial outdated. [/notice] In this tutorial I will run you through the process setting up an Express.js app and making it do what a basic website might do. You will learn the basics of routes, views, Jade templates, Stylus CSS engine, handling POST a ...

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 ...