Node - Tutorialspoint

3y ago
225 Views
37 Downloads
1.02 MB
41 Pages
Last View : 22d ago
Last Download : 3m ago
Upload by : Averie Goad
Transcription

Node.jsi

Node.jsAbout the TutorialNode.js is a very powerful JavaScript-based framework/platform built on Google Chrome'sJavaScript V8 Engine. It is used to develop I/O intensive web applications like videostreaming sites, single-page applications, and other web applications. Node.js is opensource, completely free, and used by thousands of developers around the world.AudienceThis tutorial is designed for software programmers who want to learn the basics of Node.jsand its architectural concepts. This tutorial will give you enough understanding on all thenecessary components of Node.js with suitable examples.PrerequisitesBefore proceeding with this tutorial, you should have a basic understanding of JavaScript.As we are going to develop web-based applications using Node.js, it will be good if youhave some understanding of other web technologies such as HTML, CSS, AJAX, etc.Execute Node.js OnlineFor most of the examples given in this tutorial, you will find a Try it option, so just makeuse of this option to execute your Node.js programs on the spot and enjoy your learning.Try the following example using the Try it option available at the top right corner of thebelow sample code box (on our website):/* Hello World! program in Node.js */console.log("Hello World!");Copyright & Disclaimer Copyright 2016 by Tutorials Point (I) Pvt. Ltd.All the content and graphics published in this e-book are the property of Tutorials Point (I)Pvt. Ltd. The user of this e-book is prohibited to reuse, retain, copy, distribute or republishany contents or a part of contents of this e-book in any manner without written consentof the publisher.We strive to update the contents of our website and tutorials as timely and as precisely aspossible, however, the contents may contain inaccuracies or errors. Tutorials Point (I) Pvt.Ltd. provides no guarantee regarding the accuracy, timeliness or completeness of ourwebsite or its contents including this tutorial. If you discover any errors on our website orin this tutorial, please notify us at contact@tutorialspoint.comi

Node.jsTable of ContentsAbout the Tutorial . iAudience . iPrerequisites . iExecute Node.js Online. iCopyright & Disclaimer . iTable of Contents . ii1.Introduction . 1What is Node.js? . 1Features of Node.js . 1Who Uses Node.js? . 2Concepts . 2Where to Use Node.js? . 2Where Not to Use Node.js? . 22.Environment Setup . 3Try it Option Online . 3Local Environment Setup . 3Text Editor . 3The Node.js Runtime . 3Download Node.js Archive . 4Installation on UNIX/Linux/Mac OS X and SunOS. 4Installation on Windows . 4Verify Installation: Executing a File. 53.First Application . 6Creating Node.js Application . 64.REPL Terminal . 9Online REPL Terminal . 9REPL Commands . 11Stopping REPL . 115.NPM. 12Installing Modules using NPM . 12Global vs Local Installation . 12Using package.json . 14Attributes of Package.json . 19Uninstalling a Module . 19Updating a Module . 19Search a Module . 19Create a Module . 196.Callback Concept . 21What is Callback?. 21Blocking Code Example. 21Non-Blocking Code Example. 22ii

Node.js7.Event Loop . 23Event-Driven Programming . 23Example . 24How Node Applications Work? . 258.Event Emitter . 26EventEmitter Class . 26Methods . 26Class Methods . 27Events . 28Example . 289.Buffers . 30Creating Buffers . 30Writing to Buffers . 30Reading from Buffers . 31Convert Buffer to JSON . 32Concatenate Buffers . 33Compare Buffers . 33Copy Buffer . 34Slice Buffer. 35Buffer Length . 36Methods Reference . 36Class Methods . 4110. Streams. 43What are Streams? . 43Reading from a Stream . 43Writing to a Stream . 44Piping the Streams. 45Chaining the Streams. 4611. File System . 48Synchronous vs Asynchronous . 48Open a File . 49Get File Information . 51Writing a File . 53Reading a File. 54Closing a File . 56Truncate a File . 57Delete a File . 59Create a Directory . 60Read a Directory . 61Remove a Directory . 62Methods Reference . 6312. Global Objects . 69filename . 69dirname . 69setTimeout(cb, ms) . 70clearTimeout (t) . 70setInterval(cb, ms) . 71Global Objects . 71iii

Node.jsConsole Object . 72Process Object . 7413. Utility Modules . 81OS Module . 81Path Module . 83Net Module. 85DNS Module. 92Domain Module . 9514. Web Module . 99What is a Web Server? . 99Web Application Architecture . 99Creating a Web Server using Node . 100Make a request to Node.js server . 102Creating a Web client using Node . 10215. Express Framework . 104Express Overview . 104Installing Express . 104Hello world Example . 104Request & Response . 106Request Object . 106Response Object . 109Basic Routing . 115Serving Static Files . 118GET Method . 119POST Meth

Node.js 6 No Buffering Node.js applications never buffer any data. These applications simply output the data in chunks. License Node.js is released under the MIT license. Who Uses Node.js? Following is the link on github wiki containing an exhaustive list of projects, application and companies which are using Node.js.

Related Documents:

Tall With Spark Hadoop Worker Node Executor Cache Worker Node Executor Cache Worker Node Executor Cache Master Name Node YARN (Resource Manager) Data Node Data Node Data Node Worker Node Executor Cache Data Node HDFS Task Task Task Task Edge Node Client Libraries MATLAB Spark-submit script

5. Who uses Node.js 6. When to Use Node.js 7. When to not use Node.js Chapter 2: How to Download & Install Node.js - NPM on Windows 1. How to install Node.js on Windows 2. Installing NPM (Node Package Manager) on Windows 3. Running your first Hello world application in Node.js Chapter 3: Node.js NPM Tutorial: Create, Publish, Extend & Manage 1.

CMSC 330 - Spring 2011 Recursive Descent: Basic Strategy ! Initially, “current node” is start node When processing the current node, 4 possibilities Node is the empty string Move to next node in DFS order that has not yet been processed Node is a terminal that matches lookahead Advance lookahead by one symbol and move to next node in

potential of node a or b with respect to the reference node, c. To solve for the unknown node voltages in this circuit, begin by applying Kirchhoff's current law at node a. Using Ohm’s Law, the current through R 1 and R 2 can be expressed in terms of the unknown node voltage at node

A RPL node may attach to a DODAG as a leaf node only. One example of such a case is when a node does not understand or does not support (policy) the RPL Instance's OF or advertised metric/constraint,the node may either join the DODAG as a leaf node or may not join the DODAG. A node operating as a leaf node must obey the following rules: 1.

Example of Tree Node Access . College level tree node 03000 . Dept tree node 03101 . Dept tree node 03110 . Dept tree node 03106 . Dept tree node 03120 . Dept tree node 03130 . To request LAM access to all the departments within this college, you would request the high

Une fois Node-RED installé, créez le(s) répertoire(s) dans lequel vous voulez le mettre (mkdir chemin) et copiez le repertoire de Node-RED dedans , avec la commande cp -r .node-red chemin/.node-red.Faites cette manipulation autant de fois que vous voulez de Node-RED différents. Chaque Node-RED est indépendant, et vous devrez installer

STM32 and ultra‑low‑power. 4 9 product series – more than 40 product lines . proliferation of hardware IPs and higher‑level programming languages greatly facilitates the work of developers. High‑ performance Cortex‑M STM32 F7 Ultra‑ low‑power Mainstream Cortex‑M3 STM32 F2 STM32 L1 STM32 F1 Cortex‑M STM32 F4 STM32 L4 STM32 F3 Cortex‑M M STM32 L0 STM32 F0 STM32 H7 ST .