© 2014 IBM Corporation Empowering the IBM ecosystem Introduction to Developing applications using node.js on Bluemix IBM Ecosystem Development Instructors.

Slides:



Advertisements
Similar presentations
Intel Do-It-Yourself Challenge node.js
Advertisements

Jerry Neal. Agenda ➢ About Node ➢ Modules ➢ Node Architecture ➢ NPM ➢ FAQ ➢ Other Awesome Modules! get ready to node, this session is hands on!
CSCI 3100 Tutorial 3 JavaScript & Node.js Presented by SU Yuxin Department of Computer Science and Engineering The Chinese University of Hong Kong 1.
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.
CGI Programming Languages Web Based Software Development July 21, 2005 Song, JaeHa.
RESTful Web Development With Nodejs and Express. REST Stands for REpresentational State Transfer Has the following constraints: ◦Client-Server ◦Stateless.
 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.
Windows.Net Programming Series Preview. Course Schedule CourseDate Microsoft.Net Fundamentals 01/13/2014 Microsoft Windows/Web Fundamentals 01/20/2014.
Written by Matthew Shelley for Professor Wei Shi.
Lecture 3 – Data Storage with XML+AJAX and MySQL+socket.io
Ole Erecius Tirsdag den 9. juni Programming is always at The EDGE !!!
Configuration Management and Server Administration Mohan Bang Endeca Server.
Node.js - What is Node.js? -
Web Server Programming 1. Nuts and Bolts. Premises of Course Provides general introduction, no in-depth training Assumes some HTML knowledge Assumes some.
An Introduction to Front-end Web Development Tom Perkins.
SE-2840 Dr. Mark L. Hornick1 NodeJS Server-side JavaScript.
Rails & Ajax Module 5. Introduction to Rails Overview of Rails Rails is Ruby based “A development framework for Web-based applications” Rails uses the.
Chat Room App Logan Linn Network Application Design Fall 2010.
Page 1 Node.js - What? EMEA PUG Challenge, November 2015, Copenhagen 6-Nov-15 Node.js - What?
Module: Software Engineering of Web Applications Chapter 2: Technologies 1.
Web Server Content What is web server Web Server working concept ◦ Static document ◦ Dynamic document ◦ Client side Processing Easy.
02 | Introduction to Express Stacey Mulcahy | Technical Evangelist Rami Sayar | Technical Evangelist.
02 | Introduction to Express Framework Stacey Mulcahy | Technical Evangelist Rami Sayar | Technical Evangelist.
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.
Node.JS introduction. What is Node.JS? v8 JavaScript runtime Event driven Non-blocking standard libraries Most APIs speak streams Provides a package manager.
Learn Nodejs by Building 10 projects. What is Nodejs  An Open source, Cross platform, Event Based and Non-blocking framework used to develop server side.
Introduction to Node.js® Jitendra Kumar Patel Saturday, January 31, 2015.
Configuring Nodes Application on BlueMix
Profound.js: The future of open source development on IBM i
NodeJS and MEAN cs6320.
NodeJS.
Node.Js Server Side Javascript
Physics validation database
The Server-side JavaScript
Node.js Express Web Applications
Modules, Babel, RequireJS, Other JavaScript Module 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 online Training at GoLogica.
Build Better Apps with MEAN.
Node.js talking to PROGRESS
CMPE 280 Web UI Design and Development January 30 Class Meeting
Network Programming Lecture 4: Message Posting
Node.Js Server Side Javascript
2017, Fall Pusan National University Ki-Joune Li
CS 174: Server-Side Web Programming January 29 Class Meeting
NodeJS coding basics L. Grewe.
CMPE 280 Web UI Design and Development January 30 Class Meeting
Abel Sanchez, John R. Williams
Web Programming Language
Cordova & Cordova Plugin Installation and Management
CMPE 280 Web UI Design and Development January 29 Class Meeting
Web Programming Language
INTRODUCTION TO By Stepan Vardanyan.
Console Use. Console Use Exit Console Run File.
Week 01 Node.js Week 01
Lecture 16: Writing Your Own Web Service
RESTful Web Services.
Lecture 12: The Fetch Api and AJAx
Lecture 14: JSON and Web SERVICES
Week 02 Node.js Week 02
Chengyu Sun California State University, Los Angeles
Introduction.
Client Server Architecture and Data Persistence Options
Chengyu Sun California State University, Los Angeles
Lecture 15: Writing Your Own Web Service
CMPE 280 Web UI Design and Development August 27 Class Meeting
Presentation transcript:

© 2014 IBM Corporation Empowering the IBM ecosystem Introduction to Developing applications using node.js on Bluemix IBM Ecosystem Development Instructors : – Krishnaprasad Subbarao, Abhay Ratnaparkhi

© 2014 IBM Corporation Empowering the IBM ecosystem Introduction to node.js – What is node.js – node.js first app – Components of node.js – node.js api – node.js modules – Express – npm Developing a node.js application on Bluemix – IBM DevOps Services for Bluemix Developing IOT application on Bluemix Agenda

© 2014 IBM Corporation Empowering the IBM ecosystem open source, cross-platform runtime environment for server-side and networking applications Server side Java script system applications are written in JavaScript, and can be run within the Node.js runtime. contains a built-in library to allow applications to act as a Web server Powered by Google 8 runtime provides an event-driven architecture and a non-blocking I/O API commonly used for real-time web applications. What is node.js

© 2014 IBM Corporation Empowering the IBM ecosystem Download link : First program HelloWord.js var http = require('http'); http.createServer(function (req, res) { res.writeHead(200, {'Content-Type': 'text/plain'}); res.end('Hello World\n'); }).listen(1337, " "); console.log('Server running at Cmd> node HelloWorld.js Server running at node.js first app

© 2014 IBM Corporation Empowering the IBM ecosystem node.js : Components

© 2014 IBM Corporation Empowering the IBM ecosystem Application : the user developed application Java script : prototype based scripting language V8 Javascript Engine : – Open source javascript engine developed by Google – Used by Chrome, Node.js Bindings : programs that make V8 and the library able to talk to each other. – e.g. binding for database libraries – node-js/ node-js/ node.js Components continued..

© 2014 IBM Corporation Empowering the IBM ecosystem LIBUV : – a multi-platform support library – focuss on asynchronous I/O – primarily developed for use by Node.js – also used by Luvit, Julia, pyuv and few others – Event loop Non thread safe Handles – long lived objects e.g. a TCP server handle – Call backs are called when an event occurs Requests – Short lived operations run directly on the loop node.js Components continued..

© 2014 IBM Corporation Empowering the IBM ecosystem Provides large number of built in functions, modules, add ons HTTP – provides a way to develop an http server which can process http requests Globals – require : A reference to a function used to require modules. – module : A reference to the current module – exports :A reference to the module.exports variable – console : For printing to stdout and stderr. node.js api

© 2014 IBM Corporation Empowering the IBM ecosystem A Node/npm module is just an simple JavaScript file follows the CommonJS module spec. encapsulates related code into a single unit of code Allows building re-usable code Samples modules : http, express node.js modules

© 2014 IBM Corporation Empowering the IBM ecosystem // greetings.js sayHelloInEnglish = function() { return "Hello"; }; sayHelloInSpanish = function() { return "Hola"; }; node.js modules continued..

© 2014 IBM Corporation Empowering the IBM ecosystem // greetings.js // var exports = module.exports = {}; exports.sayHelloInEnglish = function() { return "HELLO"; }; exports.sayHelloInSpanish = function() { return "Hola"; }; node.js modules continued..

© 2014 IBM Corporation Empowering the IBM ecosystem // main.js var greetings = require("./greetings.js"); Equivalent to var greetings = { sayHelloInEnglish: function() { return "HELLO"; }, sayHelloInSpanish: function() { return "Hola"; } }; node.js modules continued..

© 2014 IBM Corporation Empowering the IBM ecosystem Express : – minimal and flexible Node.js web application framework – provides a robust set of features for web and mobile applications. – – Provides 4 objects Application - app – holds the settings of the express application HTTP request – req – provides a way to read all the request parameters, query string, request body for POST requests Express

© 2014 IBM Corporation Empowering the IBM ecosystem Express : – Objects HTTP response - res – provides ways to return the response back to the client. Router – Router – accepts a set of functions attached to a path – executed when a request for the attached path or any inner path is received Express continued..

© 2014 IBM Corporation Empowering the IBM ecosystem HelloWorldExpress.js var express = require('express') var app = express() app.get('/', function (req, res) { res.send('Hello World!') }) var server = app.listen(3000, function () { var host = server.address().address var port = server.address().port console.log('Example app listening at host, port) }) Express continued..

© 2014 IBM Corporation Empowering the IBM ecosystem pre-installed package manager for the Node.js server platform. It is used to install Node.js programs from the npm registry npm init - creates a new package npm install e.g. npm install express –save – Install express and adds to package.json npm

© 2014 IBM Corporation Empowering the IBM ecosystem Contains complete structure of the application. – all packaging, dependency and version related information. important contents – main : module ID that is the primary entry point to your program – License : license information of the module. – man : to specify the help contents about this package – config : to set configuration parameters used in package scripts – Dependencies : list modules on which this module is dependent Package.json

© 2014 IBM Corporation Empowering the IBM ecosystem { "name": "samples", "version": "1.0.0", "description": "Node.js introduction samples", "main": "HelloWorld-express.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "license": "ibm", "dependencies": { "express": "^4.11.0" } Package.json

© 2014 IBM Corporation Empowering the IBM ecosystem Developing a node.js application on Bluemix