Intro to OAuth with Node.js: OAuth 1.0 (One-Legged)

This text is part of Introduction to OAuth with Node.js mini-book which is available at gum.co/hRyc.

Introduction to OAuth with Node.js
Introduction to OAuth with Node.js: Twitter API OAuth 1.0, OAuth 2.0, OAuth Echo, Everyauth and OAuth 2.0 Server Examples

Let’s start with good old OAuth 1.0. The way it usually works is as follows:

  1. For the first time, when we authorize a user to use our app, we need to perform extra work and obtain access token and secret (three-legged).
  2. You store these values for each user in your application.
  3. Then, on subsequent requests, things become much simpler. We construct auth headers and make HTTP requests (one-legged).

Continue reading “Intro to OAuth with Node.js: OAuth 1.0 (One-Legged)”

Seven Things You Should Stop Doing with Node.js

Inspired by 5 Things You Should Stop Doing With jQuery by Burke Holland, I decided to open a discussion and highlight seven things you should immediately stop doing with Node.js:

  1. Stop using callbacks
  2. Stop using * for versions
  3. Stop using console.log for debugging
  4. Stop using GET and POST for everything
  5. Stop using semicolons
  6. Stop using comma-first style
  7. Stop limiting your connections with default maxSockets value

Continue reading “Seven Things You Should Stop Doing with Node.js”

JavaScript and Node FUNdamentals is Finished

JavaScript and Node FUNdamentals: A Collection of Essential Basics is a short read to brush up and refresh JavaScript and Node.js topics including frameworks like CoffeeScript, Backbone.js and Express.js. The motto of the book is “If it’s not fun, it’s not JavaScript.

JavaScript and Node FUNdamentals: A Collection of Essential Basics
JavaScript and Node FUNdamentals: A Collection of Essential Basics

JavaScript and Node FUNdamentals has these chapters:

  1. JavaScript FUNdamentals: The Powerful and Misunderstood Language of The Web
  2. CoffeeScript FUNdamentals: The Better JavaScript
  3. Backbone.js FUNdamentals: The Cornerstone of JavaScript MV* Frameworks
  4. Node.js FUNdamentals: JavaScript on The Server
  5. Express.js FUNdamentals: The Most Popular Node.js Framework

The book is available on Amazon.com (Kindle) and LeanPub (MOBI, PDF, EPUB).

Continue reading “JavaScript and Node FUNdamentals is Finished”

Node.js FUNdamentals: A Concise Overview of The Main Concepts

Node.js is a highly efficient and scalable non-blocking I/O platform that was build on top of Google Chrome V8 engine and its ECMAScript. This means that most front-end JavaScript (another implementation of ECMAScript) objects, functions and methods are available in Node.js. Please refer to JavaScript FUNdamentals if you need a refresher on JS-specific basics.

Note: This text is a part of upcoming ebook JavaScript and Node FUNdamentals: A Collection of Essential Basics.

Node.js is a highly efficient and scalable non-blocking I/O platform that was build on top of Google Chrome V8 engine and its ECMAScript. This means that most front-end JavaScript (another implementation of ECMAScript) objects, functions and methods are available in Node.js. Please refer to JavaScript FUNdamentals if you need a refresher on JS-specific basics.

Continue reading “Node.js FUNdamentals: A Concise Overview of The Main Concepts”

Express.js and Mongoose Example: Building HackHall

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

The HackHall project was written using Backbone.js and Underscore for the front-end app, and Express.js, MongoDB via Mongoose for the back-end REST API server.

Continue reading “Express.js and Mongoose Example: Building HackHall”

Express.js FUNdamentals: An Essential Overview of Express.js

Note: This text is a part of upcoming ebook JavaScript and Node FUNdamentals: A Collection of Essential Basics.

Express.js is an amazing framework for Node.js projects and used in the majority of such web apps. Unfortunately, there’s a lack of tutorials and examples on how to write good production-ready code. To mitigate this need, we released Express.js Guide: The Comprehesive Book on Express.js. However, all things start from basics, and for that reason we’ll give you a taste of the framework in this post, so you can decide if you want to continue the learning further.

Continue reading “Express.js FUNdamentals: An Essential Overview of Express.js”

Foreword to Express.js Guide: The Comprehensive Book on Expresss.js

Dear reader, you are holding a book which will open you to understanding and fluent usage of the Express.js framework – standard de facto in web application programming on Node.js. And I would especially recommend this book because it was written by a practicing engineer, one who has a comprehensive knowledge about the full stack of web application development and Express.js in particular…

Dear reader, you are holding a book which will open you to understanding and fluent usage of the Express.js framework – standard de facto in web application programming on Node.js. And I would especially recommend this book because it was written by a practicing engineer, one who has a comprehensive knowledge about the full stack of web application development and Express.js in particular.

Continue reading “Foreword to Express.js Guide: The Comprehensive Book on Expresss.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”

Q&A: Thank You Web App, Express.js and Emails

I recently received a question from Joanne Daudier. She is a up and coming web developer, middle term student at a JS/Node.js bootcamp called RefactorU and a reader of Express.js Guide. This is what she wrote:

Hi Azat:

I skimmed over your book today. I feel like it is a bit advanced for me since I’m just learning Express. I do have a few questions for you though.

I recently received a question from Joanne Daudier. She is an up and coming web developer, middle term student at a JS/Node.js bootcamp called RefactorU and a reader of Express.js Guide. This is what she wrote:

Continue reading “Q&A: Thank You Web App, Express.js and Emails”

Solving Programming Problems

Programming problems are not that much different from mathematics or physics problems. There are usually an input and an output to which someone needs to arrive by providing an algorithm. This algorithm is typically a function or series of functions.

Programming puzzles and toy problems are good exercises to sharpen skills and prepare for technical interviews. No wonder that more and more online coding schools (e.g., CodeAcademy) make those metal workouts main staple of their courses.

Beginner programmers might benefit by applying these steps to their process of solving a programming problem:

Programming problems are not that much different from mathematics or physics problems. There are usually an input and an output to which someone needs to arrive by providing an algorithm. This algorithm is typically a function or series of functions.

Programming puzzles and toy problems are good exercises to sharpen skills and prepare for technical interviews. No wonder that more and more online coding schools (e.g., CodeAcademy) make those metal workouts main staple of their courses.

Beginner programmers might benefit by applying these steps to their process of solving a programming problem:

Continue reading “Solving Programming Problems”

The Release of Express.js Guide: The Comprehensive Book on Express.js

After weeks of writing and editing, Azat and his team are happy to announce the release of Express.js Guide: The Most Popular Node.js Framework Manual! The book is very approachable and suitable for beginners. If someone wants to save time searching the web and learn the best practices from the trenches, Express.js Guide is the book that has everything: Express.js API reference, quick start guides, 20+ meticulously explained examples and tutorials on over 270 pages with more than 60 illustrations.

Express.js is a de facto standard of Node.js development and the most popular NPM library as of today! However, as with any framework, sometimes the learning curve is steep. At HackReactor, I often asked the same questions about code organization, authentication, database connections and deployment.

Continue reading “The Release of Express.js Guide: The Comprehensive Book on Express.js”

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!

Tutorial: Node.js and MongoDB JSON REST API server with Mongoskin and Express.js

Tutorial: building a JSON REST API server with Node.js and MongoDB using Mongoskin and Express.js utilizing Mocha and Super Agent for BDD/TDD.

Update3: Expess 4 version of this tutorial is available at Express.js 4, Node.js and MongoDB REST API Tutorial, and github.com/azat-co/rest-api-express (master branch). This tutorial will work with Express 3.x.

Update2: “Mongoskin removed ‘db.collection.id’ and added some actionById methods” from this pull request with this code changes. To use the code in this post, just install an older version of Mongoskin (0.5.0?). The code in the GitHub will work with Mongoskin 1.3.20.

Update2: “Mongoskin removed ‘db.collection.id’ and added some actionById methods” from this pull request with this code changes. To use the code in this post, just install an older version of Mongoskin (0.5.0?)

Update: use the enhanced code from this repository github.com/azat-co/rest-api-express (express3 branch).

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

This tutorial will walk you through writing test using the Mocha and Super Agent libraries and then use them in a test-driven development manner to build a Node.js free JSON REST API server utilizing Express.js framework and Mongoskin library for MongoDB. In this REST API server, we’ll perform create, read, update and delete (CRUD) operations and harness Express.js middleware concept with app.param() and app.use() methods.

Continue reading “Tutorial: Node.js and MongoDB JSON REST API server with Mongoskin and Express.js”

Cisco, Node.js and other musings

The hands-on Introduction to Node.js training consisted of two days and started badly: I was late driving from Oakland to San Jose through traffic, and security personnel in the lobby took extra 15 minutes to clear and escort me to the classroom. Nevertheless, attendees quickly plunged into installing Node.js, Node Package Manager and MongoDB using hard copies of Rapid Prototyping with JS: Agile JavaScript Development that I brought with me.

Continue reading “Cisco, Node.js and other musings”

NodeConf 2013

I’m just back from NodeConf 2013 summer camp at Walker Creek Ranch in Petaluma which is in Marin County, California just a half-hour north of San Francisco.

I’m just back from NodeConf 2013 summer camp at Walker Creek Ranch in Petaluma which is in Marin County, California just a half-hour north of San Francisco.

Continue reading “NodeConf 2013”

First Six Months with Storify

Time goes fast! It’s been six months since I’ve joined Storify in December 2012. Many cool things have happened, including a bunch of new releases, a company retreat and a hackweek.

Time goes fast! It’s been six months since I’ve joined Storify in December 2012. Many cool things have happened, including a bunch of new releases, a company retreat and a hackweek.

Continue reading “First Six Months with Storify”