Home » JavaScript » Node.js (page 7)

Node.js

The mystery of no flash session variables in Express + Passport auth

Someday I started an application using NodeJS with ExpressJS framework and decided to use passport for authenticate the users. As many other times I wanted to use flash messages so, when user authentication fails, the application shows a message informing about bad credentials. Nothing new on the horizon until…. OMG !!! I can’t see the flash messages !!! Disclaimer: This is ...

Read More »

Improve Node.js Performance by Turning It into a Clusterfork

One of the big reasons people are drawn to Node.js for running web servers is the simplicity you gain from a single-threaded paradigm, versus having to deal with the challenges of threaded programming – race conditions, deadlocks, etc. However, one drawback of running a web server on a single thread means it also runs on a single core. With nearly ...

Read More »

Configuring Load Balancer with HAProxy and Node.js

Load Balancing is needed in order to distribute the load of work across multiple resources – in computer science terminology, these multiple resources can be pieces of software or hardware, where similar work processes are waiting to be executed for a processing request. So, in a web application, we will need to perform load balancing to control the user requests ...

Read More »

Playing with concurrency and performance in Java and Node.js

Imagine a simple market where buyers and sellers interested in the same product come together to trade. For each product in the market, buyers interested in the product could form an orderly queue, sorted on a “first come, first serve” basis. Each buyer could then approach the cheapest seller and trade, purchasing as much of the product from the seller ...

Read More »

Batten Down Those Node Dependency Hatches

Dependency management is oftentimes a mundane subject. And it’s not much of a subject at all if you don’t depend on rapidly changing libraries. Of course, you might not always realize you’re depending on a rapidly changing library – especially, if you happen to take a rather liberal approach of depending on snapshots or latest versions, as I often do. ...

Read More »

Rule Engine for Node.js

Based on my original blog posting, this posting introduces a ported Javascript version of my rule engine, for Node.js. I have the requirement to use a rule engine. I want something light weight and fairly simple, yet powerful. While there are products out there which are super good, I don’t want something with the big learning overhead. And, I fancied ...

Read More »

Getting a new node project started with npm

The aim of this guide is to get people getting started with Node.js and npm, while also showing some of the handy commands I use to bootstrap my projects.           Create your project directory. Change to the directory you just created. Tell git to make a repo. Pull down a preconfigured .gitignore file for node projects ...

Read More »

A canonical web test in NodeJS

Working with web applications in NodeJS is great. Using the same language and libraries on the client and server simplified the thinking. And NodeJS has fast tests and restart for a super quick edit-verify cycle when you’re coding. I like to write tests to verify the server-side and client-side logic, but do you know that the whole solution really is ...

Read More »