ALL
Write Scalable, Server-side JavaScript Applications with Node.js
If you live in the Silicon Valley area, you have already heard the buzz: Node.js is being hailed as the next big thing. It’s the silver bullet that offers scale, eases development, and can be leveraged by the vast pool of client-side JavaScript developers. So, what exactly is Node.js?Node.js is a server-side JavaScript environment that uses an asynchronous event-driven model. It is based on Google's V8 JavaScript engine plus several built-in libraries. The excitement around Node.js is that the barriers to entry are remarkably low; if you know JavaScript, you're well on your way to writi...
4,663 0 SERVER SIDE NODE.JS SCALABLE JAVASCRIPT APP
Node.js: Five Things Every PHP Developer Should Know
I recently started working on a few Node.js applications. Coming most recently from PHP (and Drupal in particular), I found the transition to Node.js to be surprisingly easy. Pleasurable, in fact. But I had to learn to think differently about a few things.Below I list the five things I think every PHP developer should know about Node.js.1. Node.js Is Built On Chrome's JavaScript EngineGoogle's browser, Chrome, has a notoriously fast JavaScript engine called V8. And this JavaScript engine can be cleanly separated from the web browser. Node.js is built on V8. This is one of the main reasons why ...
The future smells like JavaScript
Of course I am only repeating what others are preaching about the recent rise of JavaScript.But I think the movement is significant and can't be overstated. And recent developments are really even making it more and more interesting.Nobody can deny hat JavaScript is the de facto programming language of Html5. Every other language trying to bolt itself onto Html5 looks like pure friction so far. And Html5 is looking upon a prospering future.Today we are used to some established JavaScript frameworks that make working with JavaScript more fun and productive. jQuery seems to emerge as the clear l...
3,381 0 JAVASCRIPT FUTURE NODE.JS CLIENT-SIDE
An Object is not a Hash
Following my article A String is not an Error, I want to bring attention to an issue that similarly applies to JavaScript in general, but has special relevance in the Node.JS environment.The problem boils down to the usage of {} as a data-structure where the keys are supplied by untrusted user input, and the mechanisms that are normally used to assert whether a key exists.Consider the example of a simple blog created with Express. We decide to store blog posts in memory in a {}, indexed by the blog post slug. For example, this blog post would be posts['an-object-is-not-a-hash'].We start writin...
44,232 3 OBJECT HASH NODE.JS JAVASCRIPT
A String is not an Error
I decided to write a little article to discourage an unfortunately common pattern in Node.JS modules (and browser JavaScript, to a lesser extent) that can boil down to these two examples:// A:function myFunction () { if (somethingWrong) { throw 'This is my error' } return allGood;}and// B: async Node.JS-style callback with signature `fn(err, …)`function myFunction (callback) { doSomethingAsync(function () { // … if (somethingWrong) { callback('This is my error') } else { &nb...
3,610 0 JAVASCRIPT NODE.JS STRING ERROR OBJECT