Kevin Whitman's Blog

Tag: CloudFlare

I’ve been playing with Node.js

For about the past month and a half I’ve been playing with Node.js. Node.js is server-side JavaScript, using Google’s V8 JavaScript engine. Node.js can run a HTTP server, or any other type of socket connection. I’ve really only experimented with it’s HTTP server using the Express framework

I’m coming from a PHP background, so writing server backend’s in JavaScript while being asynchronous requires a slightly different mindset. In PHP, a user hits your Web server and Apache fork’s a new process, the PHP interpreter runs the script from top to bottom, then it gives the output to Apache and then dies. With Node.js, you have one process for the whole Web server. Also I find myself passing around the request and response objects a lot, unlike with PHP where you have a start.php or config.php file with variables accessible by any of the code. But after a while the stuff will come naturally to you.

I’ve started experimenting with writing a cloud based video encoding related application(not giving many details on that yet, not promising anything.) within Express, I use EJS(Embedded JavaScript) for template files so I can keep my application logic away from my views. I have configured my app I’m working on to have PHP styled open and close tags, since I’m used to template files being that way in PHP.

Another thing you have to do is define all your routes, guesses very similar to the frameworks like Ruby on Rails. Also with Express, I created a static file store to store my CSS, public JavaScript files, images and anything else I would want served statically.

Another thing I really love about Node.js is NPM(Node Package Manager). NPM is a package manager similar to apt-get that comes with Node.js. In the NPM, you can install modules, and publish modules. I’ve already wrote a few modules, to help me out on my own applications.

Some modules I wrote already are:


A module to check how much free space, and total space the hard drive has. Node.js didn’t really have any native functions for this. This module works on both Linux, Mac and Windows. On *nix systems it uses df -k and on Windows it calls a small little C# application I wrote called DriveSpace(My first C# app) that comes bundled with the module.


A simple generic round-robin. Great for database connections pools.


A simple but powerful email wrapper around Nodemailer. Also uses Basic Template, another tiny module I wrote.

Range Check

A module to detect if a IP is valid, it’s version and check if its within a certain range. I mainly wrote this to use in node_CloudFlare.


I use CloudFlare to supercharge my websites. I wanted this in Node.js, and I couldn’t really find any existing modules, So I wrote my own.


A simple module to mask emails, domains and even regular strings! Will turn [email protected] into t**t@e****


A simple yet powerful HTTP request library inspired by jQuery and LSL written in JavaScript for client and server JavaScript. I wanted a nice and clean simple to use HTTP request library for both the server and client, so I wrote one.

So those are some of the modules I wrote so far. I really enjoy Node.js, but sometimes it feels overkill compared to just whipping out a .php and just writing something quickly. I guess I’ll get more used to Node.js and get better at it as time goes on. I also want to get in to mobile development, so I think Node.js would be a great tool to write backend’s in.

5 WordPress Plugins I use

I use many WordPress plugins, but here are 5 WordPress Plugins I think are great and recommend:

After The Deadline

I use After the deadline to proofread my posts. It uses artificial intelligence to check for spelling, style and grammar. It works by sending your post to a server, and then sends the errors in your post back.


CloudFlare isn’t just a WordPress plugin. It’s a reserve proxy to add distributed denial-of-service (DDoS) protection, content distribution network (CDN), Rocket Loader and extra security.  It can asynchronously load scripts. It also can minify css and scripts for you. You can use it for non WordPress sites, but you have to install a Apache mod if you want the right IP addresses of the user to show up, which may not be easy for some people or your on shared hosting which the host provider may not have it installed or will not install it. This WordPress plugin allows WordPress to get the correct IP address of the user without mod_cloudflare. You can checkout more about CloudFlare at

WP Super Cache

I use this plugin to cache my blog to static html files to speed up my site.  So each reload won’t have to regenerate the whole page using PHP and MySQL and can just serve a cached version meaning less CPU on the server and quicker for the end user. So I think I’m Digg proof.


This plugin I use for backup my database. It also can optimize your database. You can manually back up or repair or have it do it every so many minutes, hours, days, weeks and months.


I use this plugin to flag comments as spam. This is free for personal blogs. It really does catch spam really good! I just look at the spam every so often, see if anything isn’t spam and then clear it out.

Copyright © 2010 - 2024 Kevin Whitman's Blog

Back To Top ↑