Jerry Neal. Agenda ➢ About Node ➢ Modules ➢ Node Architecture ➢ NPM ➢ FAQ ➢ Other Awesome Modules! get ready to node, this session is hands on!

Slides:



Advertisements
Similar presentations
Node.JS - Blurring the Line Between Client and Server var title = “ Node.JS - Blurring the Line Between Client and Server ”; $(this).attr(“title”, title);
Advertisements

JavaScript FaaDoOEngineers.com FaaDoOEngineers.com.
By: Craig Hecock.  A JavaScript runtime environment running Google Chrome’s V8 engine ◦ a.k.a. a server-side solution for JS ◦ Compiles JS, making it.
N ODE.J S S ERVER S IDE J AVASCRIPT Diana Roiswati ( ) Ahmad Syafii ( ) Asri Taraqiadiyu ( )
© 2014 IBM Corporation Empowering the IBM ecosystem Introduction to Developing applications using node.js on Bluemix IBM Ecosystem Development Instructors.
Introduction CSCI 444/544 Operating Systems Fall 2008.
1 CS6320 – Why Servlets? L. Grewe 2 What is a Servlet? Servlets are Java programs that can be run dynamically from a Web Server Servlets are Java programs.
Interesting facts about node.js.  Asynchronous I/O  How do they do that?..threads (usually) What do Web Servers do?
 A JavaScript runtime environment running Google Chrome’s V8 engine ◦ a.k.a. a server-side solution for JS ◦ Compiles JS, making it really fast  Runs.
Presented by…. Group 2 1. Programming language 2Introduction.
Android Introduction Platform Overview.
Windows.Net Programming Series Preview. Course Schedule CourseDate Microsoft.Net Fundamentals 01/13/2014 Microsoft Windows/Web Fundamentals 01/20/2014.
Architecture Of ASP.NET. What is ASP?  Server-side scripting technology.  Files containing HTML and scripting code.  Access via HTTP requests.  Scripting.
Ole Erecius Tirsdag den 9. juni Programming is always at The EDGE !!!
Philly.NET Hands-on Labs JAVASCRIPT SERIES. July 9: JavaScript Syntax Visual Studio ◦Projects ◦Editors ◦Debugging ◦Script blocks ◦Minification and bundling.
WaveMaker Visual AJAX Studio 4.0 Training Troubleshooting.
Advanced Java New York University School of Continuing and Professional Studies.
Node.js - What is Node.js? -
Extending ArcGIS for Server
Google Web Toolkit An Overview By Shauvik Roy Choudhary.
Oracle 10g Database Administrator: Implementation and Administration Chapter 2 Tools and Architecture.
An Introduction to Front-end Web Development Tom Perkins.
© 2006 IBM Corporation Agile Planning Web UI. © 2006 IBM Corporation Agenda  Overview of APT Web UI  Current Issues  Required Infrastructure  API.
National Taiwan University Department of Computer Science and Information Engineering National Taiwan University Department of Computer Science and Information.
Eclipse 24-Apr-17.
Zz SOCKET.IO going real time with Arnout Kazemier
David Lawrence 7/8/091Intro. to PHP -- David Lawrence.
Developing Applications with the CSI Framework A General Guide.
Introduction to Flex 2 by Rich Tretola. About Me Rich Tretola is a senior software developer at Herff Jones, Inc. specializing in Rich Internet Applications.
1 Java Servlets l Servlets : programs that run within the context of a server, analogous to applets that run within the context of a browser. l Used to.
Imagine Creating Software Without a Single Line of Code!
Plug-in Architectures Presented by Truc Nguyen. What’s a plug-in? “a type of program that tightly integrates with a larger application to add a special.
Getting Started with Aurelia
Stacey Mulcahy | Technical Evangelist Rami Sayar | Technical Evangelist.
Threads. Readings r Silberschatz et al : Chapter 4.
Node.Js 1. 2 Contents About Node.Js Web requirement latest trends Introduction Simple web server creation in Node.Js Dynamic Web pages Dynamic web page.
Stacey Mulcahy | Technical Evangelist Rami Sayar | Technical Evangelist.
Node.JS introduction. What is Node.JS? v8 JavaScript runtime Event driven Non-blocking standard libraries Most APIs speak streams Provides a package manager.
Maintaining and Updating Windows Server 2008 Lesson 8.
Introduction to Node.js® Jitendra Kumar Patel Saturday, January 31, 2015.
//liveVirtualacademy2011/ What’s New for ASP.NET 4.5 and Web Development in Visual Studio 11 Developer Preview Γιώργος Καπνιάς MVP, MCT, MCDP, MCDBA, MCTS,
1 Chapter 5: Threads Overview Multithreading Models & Issues Read Chapter 5 pages
INNOV-16: Rich User Interface for the Web???? AJAX to the Rescue Ken Wilner VP of Technology Progress Software.
Profound.js: The future of open source development on IBM i
Node.js Modules Header Mastering Node.js, Part 2 Eric W. Greene
Building Desktop Apps with Node.js and Electron
NodeJS and MEAN cs6320.
Node.Js Server Side Javascript
Physics validation database
Chapter 1: A Tour of Computer Systems
CSE 775 – Distributed Objects Submitted by: Arpit Kothari
Node.js Express Web Services
NodeJS and MEAN Prof. L. Grewe.
3 Things Everyone Knows About Node JS That You Don't
Node.js Packages Header Mastering Node.js, Part 4 Eric W. Greene
Node.Js Server Side Javascript
NodeJS coding basics L. Grewe.
CSE 154 Lecture 22: AJAX.
Abel Sanchez, John R. Williams
Building responsive apps and sites with HTML5 web workers
INTRODUCTION TO By Stepan Vardanyan.
Console Use. Console Use Exit Console Run File.
JavaScript CS 4640 Programming Languages for Web Applications
Lecture 12: The Fetch Api and AJAx
Introduction.
Chapter 4: Threads.
Web Client Side Technologies Raneem Qaddoura
Running C# in the browser
JavaScript CS 4640 Programming Languages for Web Applications
Presentation transcript:

Jerry Neal

Agenda ➢ About Node ➢ Modules ➢ Node Architecture ➢ NPM ➢ FAQ ➢ Other Awesome Modules! get ready to node, this session is hands on!

About Node ➢ Open Source, cross-platform runtime environment for server-side and networking applications ➢ Initial Release May 27, 2009 ➢ Created by Ryan Dahl ➢ Stable Release ➢

About Node ➢ Applications are written in JavaScript ➢ Runs on Google’s V8 Engine (same as Chrome) No Browser Quirks!

Is Node JS a serious option for enterprise applications? In fact, it’s our best option for typical (heavy data IO) web applications! Let’s see why…

Why Node? ➢ Less keystrokes with JS ➢ JS on server and client allows for more code reuse ➢ A lite stack (quick create- test cycle) ➢ Large number of offerings for web app creation Build Fast!

Why Node? ➢ Fast V8 Engine ➢ Great I/O performance with event loop! ➢ Small number of layers ➢ Horizontal Scaling Run Fast!

Why Node? ➢ JS across stack allows easier refactoring ➢ Smaller codebase ➢ See #1 (Build Fast!) Adapt Fast! “There’s a shift in enterprise IT, unbundling the monolith software packages [at many companies] that has stifled innovation.” - Joe McCann CEO NodeSource

Community ➢ Over 2 million downloads per month ➢ NPM averages 211 new modules per day (ruby gems 68 per day, maven 61 per day) ➢ Total Number of npm Packages: 105,109 ➢ Second most stared project on Github ➢ Plus, corporate backing from JoyentJoyent

Community

Running Node Apps Hands On #1 – ‘Welcome Noder!’

Node Globals ➢ process – object providing information and methods for the current process ➢ process.stdout, process.stderr, process.stdin, process.argv, process.env ➢ console – allows printing to stdout and stderr ➢ require() – function to load a module ➢ module – refers to the current module

Modules ➢ Modules allow Node to be extended (act as libaries) ➢ We can include a module with the global require function, require(‘module’) ➢ Node provides core modules that can be included by their name: ➢ File System – require(‘fs’) ➢ Http – require(‘http’) ➢ Utilities – require(‘util’)

Modules ➢ We can also break our application up into modules and require them using a file path: ➢ ‘/’ (absolute path), ‘./’ and ‘../’ (relative to calling file) ➢ Any valid type can be exported from a module by assigning it to module.exports

Modules bar.js module.exports = ‘I am a string’ foo.js var msg = require(‘./bar.js’) console.log(msg) // prints ‘I am a string’

Modules bar.js module.exports.hello = function() {return ‘hello’} module.exports.bye = function() {return ‘bye’} foo.js var bar = require(‘./bar.js’) console.log(bar.hello()) // prints ‘hello’ console.log(bar.bye()) // prints ‘bye’

Requiring Modules, File System, Args Hands On #2 – ‘Require It’

Node Architecture V8 Thread Pool (libeio) Event Loop (libev) Node Bindings (socket, http, etc.) Node Standard Library C C++ JavaScript

Node Architecture ➢ Node handles requests with a single thread (the event loop)!

Node Architecture ➢ How can this be faster? ➢ Expensive I/O is moved off request thread (in traditional multi-threaded environments, each thread handles the complete request) ➢ Threads are limited by RAM and are expensive to create ➢ Avoids context switching ➢ Allows us to easily write asynchronous code without heavy thread management (synchronization, message passing, etc.)

Node Architecture

Warning! Be careful to keep CPU intensive operations off the event loop.

Http and Streams Hands On #3 – ‘Real Time Data Flow’

NPM ➢ Modules can be shared by packaging ➢ Node Package Manager (NPM) is a package manager for node ➢ Command line interface ➢ Public registry ➢ Allows us to install packages from repo, and publish our own

NPM ➢ First, we need to create a package.json file for our app ➢ Contains metadata for our app and lists the dependencies ➢ Package.json Interactive Guide Package.json Interactive Guide

NPM ➢ Common npm commands: ➢ npm init initialize a package.json file ➢ npm install -g install a package, if –g option is given package will be installed as a global, --save and --save-dev will add package to your dependencies ➢ npm install install packages listed in package.json ➢ npm ls –g listed local packages (without –g) or global packages (with –g) ➢ npm update update a package

NPM ➢ SemVar Versions (version [Major].[Minor].[Patch]): ➢ = (default), >, =, <= ➢ * most recent version ➢ – version greater than and less than ➢ ~1.2.3 most recent patch version greater than or equal to (>=1.2.3 <1.3.0) ➢ ^1.2.3 most recent minor version greater than or equal to (>=1.2.3 <2.0.0)

Http and Express Hands On #4 – ‘Services’

FAQ ➢ V8 engine performs just as good, if not better than jvm ➢ Most ‘intensive’ code is usually due to I/O ➢ If needed, child processes, web workers, and so forth can be used ➢ Of course! As always, be aware of language holes (like ‘eval’) ➢ Node Security Project lists vulnerabilities in packages Node Security Project What about CPU intensive code?Is Node secure?

FAQ ➢ Most ‘cryptic’ code is DOM related (ex. selectors) ➢ Preprocessors and ECMAScript 6 bringing more strict typing (and compile time checking) ➢ As always, need standards and best practices! What about code readability/maintenance with JavaScript?

FAQ ➢ Built-in Node debugger not great, but IDEs and other tools have the usual debugging experience ➢ V will improve tracing capabilities to allow better performance monitoring, and production grade tools such as New RelicNew Relic Isn’t debugging and production monitoring bad?

Other Awesome Modules ➢ koa – middlware using generators koa ➢ async – higher order functions and common patterns for asynchronous code async ➢ lodash – utility library lodash ➢ request – simplified http client request ➢ mongoose – MongoDB ODM mongoose ➢ rethinkdb – driver library for RethinkDB rethinkdb

Other Awesome Modules ➢ moment – utilities for dates moment ➢ bluebird – promise based library bluebird ➢ config – runtime configuration config

Thanks! Learn More at