What CommonJS Is

Recently, I stumbled upon a article talking about CommonJS. In this short article, I try to shed some lights on CommonJS's history, the reason it was started and how it can be useful to developers building open API and JavaScript based Web applications.

Background

The CommonJS project was started in Jan 2009 by Kevin Dangoor, a software developer currently working on the Brackets project for Adobe. The first group was formed in 2009 was "ServerJS" that later become "securable modules". That later became CommonJS API 0.1. In April 2009, the CommonJS modules were shown off with several implementations at the first JSConf in Washington, DC. Eventually, in August 2009, the group name was formally changed to CommonJS to reflect the broader applicability of the APIs.

CommonJS

JavaScript is mostly known for client-side scripting of Web applications. However, JavaScript is a powerful object oriented language with some of the fastest dynamic language interpreters around. It can be used to write more than just client-side scripting.

The CommonJS API allows developers to build APIs and server-side APIs and libraries. These APIs and libraries can be consumed by any other non-JavaScript application.

JavaScript with a CommonJS-compliant systems can be used to write server-side JavaScript applications, command line tools and even desktop GUI-based applications. CommonJS and JavaScript combined can also be used to build complete hybrid applications.

For the source and more details, visit http://www.commonjs.org/

Reference

Let's say you're a .NET developer that wants to build a web application. On the UI side, you will use ASP.NET and some JavaScript for scripting. You are most likely to use C# as your server-side language to build APIs and libraries. You are probably going to use C# as a business and middle layers. 

What if you don't know C# or any other language but JavaScript? If you know JavaScript only, you can use CommonJS to build your APIs and server-side libraries.
 

Up Next
    Ebook Download
    View all
    Learn
    View all