The Handyjs blog


All men may be born equal but if you are developing web apps, you certainly do not want to treat all your users the same. You may have users who have paid to access premium features of your service or perhaps, certain users are designated as administrators who wield awesome powers that would be devastating in the hands of mere mortals. In almost all but the simplest webapps, it is crucial to be able to differentiate between classes of users and treat them accordingly.

The simplest way to perform access control, for most general ...  (more)

Every app needs some tasks to run periodically on a schedule. It could be scheduling a daily backup of the database, sending out a weekly newsletter or performing some computationally intensive tasks that need to occur asynchronously. Usually cron is initiated by an external service that calls the app at an appropriate path (e.g. example.com/cron) every so often. Most linux distributions ship with a scheduling system called, what else, "Cron" that can be used to schedule commands to call your web app (we'll go into details of how later on) so this i ...  (more)

Nodejs has an amazingly simple system for managing modularity in web app development. All you need to do is just place the the functionality in its own module and simply "require" it where ever it is needed. This helps to ensure the global scope is not polluted and modules can simply be modified and upgraded as needed without affecting the apps built on it.

  
    // import module "newFunctionModule"
    var newFunction = require('newFunctionModule');
  

But here is where the Nodejs "requir ...  (more)

You just spent the last couple weeks coding up a great new nodejs web app. You finally got all the bugs worked out (at least those you can see) and are ready to ship and have your code shine in front of the whole world. Then it hits you, how do you go from running your nodejs web app on your laptop to putting it up on the cold, hard internet.


No thread, no service, no problem?
So what are the problems? First, unlike PHP where you simply upload your code to the server and hit refresh, Nodejs apps should be ru ...  (more)