Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Node.Js

Megha
April 30, 2016

 Node.Js

Delivered this talk on Node.js in GDG Developers Conclave @ Rajkot.

It gives basic idea about node.js. How node.js works? How easily we can get started with node.

Megha

April 30, 2016
Tweet

Other Decks in Technology

Transcript

  1. Agenda • Introduction • Current System vs Node JS •

    Async vs Sync • Event Mechanism • REPL • Global Object • Modules • Express •Npm – Node Package Manager •Publish Custom Package •Q&A
  2. Introduction • JavaScript Runtime • Built upon V8 engine •

    Written in 2009 by Ryan Dhal • Non blocking I/O • Run without browser • Server side web applications
  3. Current System vs Node JS • Complex to build server

    on existing High end technology. • Server and client side can be build in single technology. • Built upon observer pattern for single thread between multiple request • Single Thread - Node js • Multiple Thread - Current high end servers • Context switching
  4. Async vs Sync Async: Send query/request Continue to execute other

    piece of code Whenever query/request result comes send it to callbacks Sync: Send query/request Wait for result to come for query/request
  5. Event Mechanism • Everything in Node JS is event based.

    • It runs on event based loop. • Register for event and whenever it fires caller will be notified. • Don’t need to wait for event to be complete. • Callbacks
  6. REPL • Read Eval Print Loop • Interactively run JavaScript

    • Command line interface for node • Debugging, Testing or just trying out • Multiline function allowed • Run : node • .help • _ - reserved for last expression result
  7. Global Object • Global object in node.js • Top level

    scope • Process object • require - Node module loading system • Similar to window object which we are having in browser
  8. Modules • Everything in Node JS is module. • Types

    of module • Built in module • Custom module • How to import modules in Node JS? • Example for module
  9. Npm – Node Package Manager • What is npm? •Built

    in package manager for Node •Npm Repository • How to install package using npm? •Search for specific package in npmjs.com and run npm command • What is package.json? •Contains metadata about app or module. • How to create package.json?
  10. NPM •Convenient way to manage your node.js dependencies. •When someone

    takes our project, they can directly run “npm install” •-g : Globally install •without -g install locally
  11. Express • Web application framework. • Rapid development of Node

    based web applications. • Set up middlewares to response HTTP request. • Routing mechanism simplified.
  12. Publish module • Publish module to npm registry • npm

    adduser • Publish Module • npm publish • npm unpublish