Monday, September 21, 2015

A retouch of JavaScript and Node

It has been more than two years since I last touched JavaScript and Node. My current projects are mostly centered around Java. But it was always fun to come back and refresh my memory and knowledge about it.

It almost feels like traveling through time machine, too many things have changed over the past two years. Node was forked into io.js and ES6 has been out and getting traction. And there are new frameworks out each week. Frontend engineers must have been having a tough life to keep up, and tons of fun as well.

Here I just keep some book notes for my reading through the book "Node.js in Action". The book itself turned out to be a bit outdated, but many basics are still valid. There is also another more recent Manning book "Node.js in Practice".

Difference between exports and module.exports
exports is a reference to module.exports, so as long as you do not reassign it to something different, they are the same.

Module search sequence
search for node_modules recursively from current directory, if not found, then search for environment variable NODE_MODULE or NODE_PATH.

Module require search sequence
Search for index.js, then inside package.json to find the "main" definition.

Flow control libraries
See article for a discussion about how to handle async programming with JavaScript: How to survive asynchronous programming in JavaScript

unit test frameworks
should.js: assertion lib: https://github.com/tj/should.js/

functional test frameworks

Keep app running/restart


Node Web frameworks, so many of them
Hapi from walmartlabs: http://hapijs.com
A good intro about why Hapi was created: http://hueniverse.com/2012/12/20/hapi-a-prologue/

Kraken from paypal: http://krakenjs.com
Koa, next gen Node Web framework using ES6: http://koajs.com
LoopBackhttp://loopback.io
Sailsjs, MVC pattern similar to RoR: http://sailsjs.org





Performance comparison of Express, hapi, and Restify: https://raygun.io/blog/2015/03/node-performance-hapi-express-js-restify/

5 comments:

  1. Awesome work man, you are truly a messiah for many people. Please keep doing the incredible work that you do and keep simplifying other people lives. Thumbs Up !!

    ReplyDelete
  2. I was searching for the matter you shared through blog. It is quite interesting and obviously very informative for me. Thanks you very much! Nonton Drama Korea

    ReplyDelete
  3. Thanks for sharing this informative post. Looking forward to read more.
    Best Web Design and Development Company

    ReplyDelete
  4. Node.Js development has become very popular over the last four years and continues to stand the competition in 2021, making startups worldwide choose it over other available options.
    Dark Bears is the top Mobile App Development Company in USA.
    Hire node js experts from Dark Bears and infuse Nodejs in your business better experience.

    ReplyDelete
  5. I feel really happy to have seen your webpage and look forward to so many more entertaining times reading here. Thanks once more for all the details.


    linen sarees
    silk cotton sarees
    dhoti for men
    silk shirts for men
    designer silk sarees

    ReplyDelete