• Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
  • let's 'right' some modules :D LOL
    Are you sure you want to
    Your message goes here
No Downloads


Total Views
On Slideshare
From Embeds
Number of Embeds



Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

    No notes for slide
  • Demo hello-world.js and hello-world.phpThen hello-world-2.js Actually there isn't a lot new here. But then again, there was nothing new about node either. Node uses non-blocking IO for fast scalable servers. That's been known about for years among the C community. It uses event based, single thread javascript for logic. That's exactly what the browser has. Add these together and we all see the huge splash it's made. It's the unique combination of some simple but complimentary ideas that really make these projects zing.
  • Re – usability of code. Give example of YUIExecute JS based on device.
  • Hello-server.js
  • Show npm search, install,ls, uninstallShow search.npmjs.orgMath.js


  • 1.
  • 2. #hacking withnode.JS
    Picture Source: http://bethesignal.org/blog/2011/01/06/speaking-lca2011-html5-nodejs/
  • 3. What is node.js?
  • 4. Node is an exciting new platform developed byRyan Dahl.
  • 5. It is a lot of sugar on v8
  • 6. It allows JavaScript developers to create extremely high performance servers by leveraging Google's V8 JavaScript engine, and asynchronous I/O.
  • 7. Never wait it the motto
  • 8. Recap… What is Node.js?
    • Node is an exciting new platform developed by Ryan Dahl.
    • 9. It allows JavaScript developers to create extremely high performance servers by leveraging Google's V8 JavaScript engine, and asynchronous I/O.
    • 10. Node is a lot of Sugar written on V8
    • 11. Never wait is the motto. Either to fetch a page from the web or fetch data from a DB.
  • let us look at…
  • 12. DUCK! There will be code…
    Lets see cod
  • 13. LAMP STACK
    1. Order
    2. Waits for the food
    to be cooked
    3.Food is ready
    4. Serve
  • 14. Node JS
    1. Order
    2. Places the order
    with the cook
    3. Immediately moves on to take the order from the next table
    4. Cook notifies that the food is
    5. Food is served
  • 15. commonjs
    CommonJS is a community driven effort to standardize packaging of JavaScript libraries, known as modules. Modules written which comply to this standard provide portability between other compliant frameworks such as narwhal, and in some cases even browsers.*
    * Conditions Apply
  • 16. Why node.js?
  • 17. Global objects
  • Require
    This is used to specify that a module is required.
    var operation = require(“pow”)
  • 20. Module/ exports
    This is used to package JavaScript libraries and expose the functionality to be used else where.
    exports.pow = function (a, b) {

  • 21. process
    • The process object is a global object and can be accessed from anywhere.
    • 22. It is an instance of EventEmitter.
    • 23. Can be thought as an equivalent to Window object in the browser
    • process.cwd()
    • 24. process.exit(1)
    • 25. process.argv
    • 26. process.on('exit', function () {
    • process.on('uncaughtException', function (err) {
  • 27. Simple http server
    /* File Name: hello-server.js */
    /* Include the http module. */
    var http = require('http');
    /* Create a server which accepts Request - req and returns Response - res */
    http.createServer(function (req, res) {
    /* Set the HTTP header for the response. */
    res.writeHead(200, {'Content-Type': 'text/plain'});
    /* End the HTTP response */
    res.end('Hello Worldn');
    }).listen(9000, "");
    /* Print a message to indicate that the server is running. */
    console.log('Server running at');
  • 28. Modules lets right some
  • 29. Calculate power of a number
    exports.pow = function (a, b) {
    /* Check if a number is passed. */
    if (isNaN (a-0) || isNaN (b-0)) {
    return null;
    varans = 1;
    for (vari = 1; i <= b; i++) {
    ans *= a;
    return ans;
    Link: https://github.com/harsharv/OpenHackDay2011/blob/master/hello-server.js
  • 30. twitter search module
  • 31. Npm – node package manager
    • npm is the package manager for the Node JavaScript platform
    • 32. It puts modules in place so that node can find them, and manages dependency conflicts intelligently.
  • More about npm
    • Install NPM
    curl http://npmjs.org/install.sh | sh
    • Browse the packages of NPMhttp://search.npmjs.org/
  • Npm basic commands
  • Yui3 and node.js
  • 36. resources
    • http://nodejs.org/
    • 37. http://npmjs.org/
    • 38. http://www.yuiblog.com/blog/2010/04/05/running-yui-3-server-side-with-node-js/
    • 39. http://developer.yahoo.com/yui/3/
    • 40. http://github.com/davglass/nodejs-yui
    • 41. http://github.com/davglass/yui-express
    • 42. http://github.com/harsharv/OpenHackDay2011
  • Harsha R. Vashishtmail@harsharv.com