Q&A: ImageMagick and Code Organization in Express.js

We continue with the Q&A from our readers. This is a question from Ian, the reader of Rapid Prototyping with JS.

We continue with the Q&A from our readers. This is a question from Ian, the reader of Rapid Prototyping with JS.

Continue reading “Q&A: ImageMagick and Code Organization in Express.js”

ExpressWorks: an Automated Express.js/Node.js Workshop and Tutorial

ExpressWorks is an automated Express.js/Node.js workshop.

TL;DR: ExpressWorks is an automated Express.js/Node.js workshop.

Continue reading “ExpressWorks: an Automated Express.js/Node.js Workshop and Tutorial”

Todo App with Express.js/Node.js and MongoDB

Todo apps are considered to be quintessential in showcasing frameworks akin to famous Todomvc.com for front-end JavaScript frameworks. In this example, we’ll use Jade, forms, LESS, AJAX/XHR and CSRF.

Note: This tutorial is a part of Express.js Guide: The Comprehensive Book on Express.js.

Todo apps are considered to be quintessential in showcasing frameworks akin to famous Todomvc.com for front-end JavaScript frameworks. In this example, we’ll use Jade, forms, LESS, AJAX/XHR and CSRF.

In our Todo app, we’ll intentionally not use Backbone.js or Angular to demonstrate how to build traditional websites with the use of forms and redirects. In addition to that, we’ll explain how to plug-in CSRF and LESS.

Example: All the source code is in the github.com/azat-co/todo-express for your convenience.

Continue reading “Todo App with Express.js/Node.js and MongoDB”

NodeFramework.com: 5 New Node.js Frameworks and Express.js Todo app

Tonight I merged and closed two pull requests and made a few additions to the nodeframeworkc.com project. The updates include 5 new frameworks and Express.js Todo App which is one of the four major tutorials in my new book Express.js Guide which is coming in a next 1-2 weeks. The ebook is sent to editors and it’s the main cause for the lack of new posts at this weblog.

Tonight I merged and closed two pull requests, and made a few additions to the nodeframework.com project. The updates include new logos (NPM+JS), typo fixes, 5 new frameworks and Express.js Todo App which is one of the four major tutorials in my new book Express.js Guide. The ebook is virtually ready and is sent to editors. It was the main cause for the lack of new posts at this weblog. Express.js Guide: The Most Popular Node.js Framework Manual is coming in a next 1-2 weeks. It’s almost 300 pages thick and has over 50 illustrations of many code examples. Hurry up if you want to get advantage of the 3x low pre-order price of $9.99 vs. the regular price of $29.99.

Continue reading “NodeFramework.com: 5 New Node.js Frameworks and Express.js Todo app”

PHP vs. Node.js

TL;DR: PHP is not going to disappear immediately, but its positions are undermined even further by the nascent Node.js.

When the Internet exploded in the 2000s, PHP was a thing all the cool kids did. It was extremely revolutionary, because:

  • It was an interpreted language unlike C++ or Java which require the source code compilation
  • It had the ability to be used directly with HTML by mixing within its template files with a <%php ... %> markup tags
  • It had cheap shared hosting providers on Apache servers with a Linux, Apache, MySQL and PHP (LAMP) stack
  • It had a functional nature which is easier to learn than the object-oriented programming

Over the years, PHP and its apps became a monstrous technology vulnerable to security threats (e.g., SQL injections), lack of a centralized packaging registry (was Composer inspired by Node Package Manager?), inconsistent API and subpar performance. There are many better alternatives to PHP, e.g., Ruby on Rails and Django, however nothing is as approachable as Node.js.

For those of you who aren’t familiar with Node.js, or who have heard of it but can’t quite grasp the concept, here is my analogy:

Node.js is functionally similar to the PHP + Apache or ASP + IIS stacks.

Nowadays, Node.js is gaining momentum. The platform uses JavaScript. It’s functional, and its non-blocking I/O mechanism allows for a better performance. Node.js comes with a robust Node Package Manager solution and the specification, i.e., ECMAScript.

Because Node.js is a lower-level technology, it is not comparable to complex frameworks like Struts, Rails or Django directly.

Therefore, many people, whether software engineers or entrepreneurs, are often faced with the decision of “What tech stack to use” In this article PHP vs. Node.js, we’ll compare apples-to-apples approaching the question from different angles, such as:

  • Syntax
  • Context switch
  • Modules
  • Ecosystem
  • Frameworks
  • Real-time apps
  • Database apps
  • Third-party services apps
  • Web servers
  • Hosting
  • Performance

Continue reading “PHP vs. Node.js”

Web Frameworks for Node.js

Note: For a detailed Express.js learning resource, please check out Express.js Guide: The Most Popular Node.js Framework Manual book.

TL;DR Visit nodeframework.com.

Node.js is one of the fastest growing platforms, but its’s relatively young. Therefore, there’s no dominant framework like Django for Python, Rails for Ruby or Cake for PHP. Node.js frameworks niche is level playing field.

There are multiple libraries and philosophies including MVC concept, configuration over convention, applying principles from Ruby on Rails, and the approach of merging front-end and back-end. It becomes more tedious for developers to make an educated right choice. Because of it, we put together a resource called nodeframework.com (also nodeframeworks.com and mvcnode.com, which one you like the best?) which serves as a hand-picked registry of web frameworks for Node.js. It’s an open-source project so please feel free to contribute examples, descriptions or awesome new Node.js frameworks!

This website is not intended for use with JavaScript disabled

I’m working on materials for technical workshop. The topic is “Rapid Prototyping with JavaScript”. It is mostly about jQuery, Backbone, AJAX, RESTful APIs, NodeJS and MongoDB. So a lot of JavaScript on a client side and today I was asked a question by curious friend who saw my frequent updates about the event on Facebook:

“What about users who has JavaScript disabled?”

The questions made my smile and I intuitively answered:

“It’s 2012, right? The number of such users must be insignificant”.

And later I proved to be right — only 2% of Yahoo.com users have JavaScript disabled.

Another article shows why Yahoo.com data is a good source. It has almost all of the countries covered so we can get average numbers and numbers per each country.

But I wanted to analyze the change. Just about 5 years ago companies seriously considered not to innovate AJAX-y way so they can please non-JavaScript users. Now, I barely hear about such non-sense. Even the opposite is true – startups limit their environments to only WebKit browsers. What happened to that attitude? How did that happened? One theory is that Chrome and Firefox became more popular and an update to the newer and faster versions became just a click away or even automatic in most (default) cases. JavaScript de-facto became a web standard. Not using JS is a misfit.

I can’t imagine my life without Google Docs, GMail, Facebook chat and other wonderful things which are brought to us but small scripting language which started in 1995 at Netscape as a way to make text blink if not for the XMLHTTPRequest object. Brilliant minds even overcame cross-origin limitation with dynamically injecting script tags into to DOM. This technique is known as JSONP. But that is me — sort of advanced user.

Just a few days ago Adobe announced on 5th anniversary of iPhone release, which never supported Adobe Flash, that they will discontinue support of Flash plug-in in new Android 4.1, Jelly Bean. This event completes triumph of JavaScript as cross platform tool for web and mobile development.

For those unfortunate people (2% of Yahoo.com users) and search engine bots I must remember to put noscript into my HTML:

<noscript>
    This website is not intended for use with JavaScript disabled.
    Unless you are a googlebot, telnet or i486-PC user, please go get the latest version of Chrome.
</noscript>

One side note: mission critical applications without control over clients’ environment, corporate and government organizations which must try to server all users still have to take into account a lot of things which consumer facing and startup companies could get away with. Being section 508 complaint also falls into this category.