Node.js I Getting Started

Similar documents
NODE.JS MOCK TEST NODE.JS MOCK TEST I

Indium Documentation. Release Nicolas Petton

INF5750. Introduction to JavaScript and Node.js

WebStorm, intelligent IDE for JavaScript development

Using a debugger. Segmentation fault? GDB to the rescue!

Node.js. Node.js Overview. CS144: Web Applications

Ionic Tutorial. For Cross Platform Mobile Software Development

WRITING CONSOLE APPLICATIONS IN C

JavaScript I Language Basics

5/19/2015. Objectives. JavaScript, Sixth Edition. Understanding Syntax Errors. Introduction to Debugging. Handling Run-Time Errors

Smashing Node.JS: JavaScript Everywhere

NetBeans Tutorial. For Introduction to Java Programming By Y. Daniel Liang. This tutorial applies to NetBeans 6, 7, or a higher version.

The course is supplemented by numerous hands-on labs that help attendees reinforce their theoretical knowledge of the learned material.

PAS for OpenEdge Support for JWT and OAuth Samples -

What s New in Enterprise Jeff Simpson Sr. Systems Engineer

CSCI 201 Google Chrome DevTools

Unveiling Zend Studio 8.0

MayLoon User Manual. Copyright 2013 Intel Corporation. Document Number: xxxxxx-xxxus. World Wide Web:

IBM Image-Analysis Node.js

Choose OS and click on it

Web Interface Installation Guide. Version 8.2

PathFinder-XD for MIPS Powered Devices. Simulator

TIBCO LiveView Web Getting Started Guide

Labs instructions for Enabling BeagleBone with TI SDK 5.x

GETTING STARTED WITH ECLIPSE Caitrin Armstrong

Module 3: Working with C/C++

SublimeLinter Documentation

Java vs JavaScript. For Enterprise Web Applications. Chris Bailey IBM Runtime Technologies IBM Corporation

IBM C Rational Functional Tester for Java. Download Full Version :

Advance Mobile& Web Application development using Angular and Native Script

J, K, L. Node.js require() method, 403 package.json, 401 streams functionality, 401 task() method, 401 use strict statement, 403

Strategies for Building Mobile Apps Using ArcGIS API for JavaScript

Red Hat Developer Tools

April 4-7, 2016 Silicon Valley. CUDA DEBUGGING TOOLS IN CUDA8 Vyas Venkataraman, Kudbudeen Jalaludeen, April 6, 2016

Section 1. How to use Brackets to develop JavaScript applications

Intermediate Python 3.x

Defining New Node-RED Nodes

Writing your first Web Data Connector

CLIs and Developers The Secret Sauce to a Brighter Mainframe. Chris Boehm Software Engineer CA Technologies

IDWedgeKB Serial Port and NodeJS

Bitnami ProcessMaker Community Edition for Huawei Enterprise Cloud

Exercise 1. Bluemix and the Cloud Foundry command-line interface (CLI)

Application Note: AN00193 Getting Started with Debugging in xtimecomposer

Eclipse-Based CodeWarrior Debugger

DCLI User's Guide. Data Center Command-Line Interface 2.7.0

CSE 351. GDB Introduction

Module Road Map. 7. Version Control with Subversion Introduction Terminology

JavaScript CS 4640 Programming Languages for Web Applications

Bitnami Piwik for Huawei Enterprise Cloud

Lab 2 Examine More Development Features in IBM Worklight

JDB - QUICK GUIDE JDB - INTRODUCTION

Pro JavaScript. Development. Coding, Capabilities, and Tooling. Den Odell. Apress"

Eclipse Tutorial. For Introduction to Java Programming By Y. Daniel Liang

Bitnami Coppermine for Huawei Enterprise Cloud

Bitnami MEAN for Huawei Enterprise Cloud

Installation Manual and Quickstart Guide

Etasoft XT Server 1.x

Supplement H.1: JBuilder X Tutorial. For Introduction to Java Programming, 5E By Y. Daniel Liang

Supplement II.B(1): JBuilder X Tutorial. For Introduction to Java Programming By Y. Daniel Liang

Code::Blocks Student Manual

Code Editor. The Code Editor is made up of the following areas: Toolbar. Editable Area Output Panel Status Bar Outline. Toolbar

How to start with 3DHOP

Bitnami Node.js for Huawei Enterprise Cloud

Tools. SWE 432, Fall Design and Implementation of Software for the Web

Bitnami ez Publish for Huawei Enterprise Cloud

Bitnami TestLink for Huawei Enterprise Cloud

DCLI User's Guide. Data Center Command-Line Interface 2.9.1

Introducing LLDB for Linux on Arm and AArch64. Omair Javaid

21. This is a screenshot of the Android Studio Debugger. It shows the current thread and the object tree for a certain variable.

IBM LOT-408. IBM Notes and Domino 9.0 Social Edition Application Development Updat.

Cloud I - Introduction

News in RSA-RTE 10.1 updated for sprint Mattias Mohlin, January 2018

Chris Simpkins (Georgia Tech) CS 2316 Data Manipulation for Engineers Python Overview 1 / 9

TIBCO LiveView Web Getting Started Guide

Lesson: Web Programming(4) Omid Jafarinezhad Sharif University of Technology

BioStar Integration for Nedap SETUP GUIDE. Version 1.10 English

STU SigCaptX Guide. STU SigCaptX Guide. STU SigCaptX. Global Signature Development Team. December Page 1 of 12

We first learn one useful option of gcc. Copy the following C source file to your

Table of Contents 1.1. Install, Deploy, Maintain Infrastructure Installation Download. Deploy the Appliance

PTN-202: Advanced Python Programming Course Description. Course Outline

AWS Lambda + nodejs Hands-On Training

24x7 Scheduler Web-based Management Console User's Guide Version 5.3

News in RSA-RTE 10.2 updated for sprint Mattias Mohlin, May 2018

TotalView. Debugging Tool Presentation. Josip Jakić

JHU Economics August 24, Galaxy How To SSH and RDP

Chapter 1 - Development Setup of Angular

Modern Web Application Development. Sam Hogarth

OSSW ICOSST 2009, Al-Khawarizmi Institute of Computer Science University of Engineering and Technology, Lahore

Bitnami Dolibarr for Huawei Enterprise Cloud

DCLI User's Guide. Data Center Command-Line Interface

RubyMine, the most advanced Ruby and Rails IDE

Web Robots Platform. Web Robots Chrome Extension. Web Robots Portal. Web Robots Cloud

DCLI User's Guide. Modified on 20 SEP 2018 Data Center Command-Line Interface

News in RSA-RTE 10.1 updated for sprint Mattias Mohlin, November 2017

Administration Manual

VMware Fusion Tech Preview 2017: API/CLI Getting Started Guide

How Do I Inspect Error Logs in Warehouse Builder?

Parallel Debugging. ª Objective. ª Contents. ª Learn the basics of debugging parallel programs

Javascript Validator Xml Schema Eclipse Plugin

Using Eclipse Che IDE to develop your codebase. Red Hat Developers Documentation Team :54:11 UTC

Transcription:

Node.js I Getting Started

Chesapeake Node.js User Group (CNUG) https://www.meetup.com/chesapeake-region-nodejs-developers-group

Agenda Installing Node.js Background Node.js Run-time Architecture Node.js & npm software installation JavaScript Code Editors Installation verification Node.js Command Line Interface (CLI) Read-Evaluate-Print-Loop (REPL) Interactive Console Debugging Mode JSHint Documentation

Node.js Background What is Node.js? Node.js is a server side (Back-end) JavaScript runtime Node.js runs V8 Google s high performance JavaScript engine Same engine used for JavaScript in the Chrome browser Written in C++ https://developers.google.com/v8/ Node.js implements ECMAScript Specified by the ECMA-262 specification Node.js support for ECMA-262 standard by version: https://node.green/

Node.js Node.js Run-time Architectural Concepts Node.js is designed for Single Threading Main Event listeners are single threaded Events immediately handed off to the thread pool This makes Node.js perfect for Containers JS programs are single threaded Use asynchronous (Non-blocking) calls Background worker threads for I/O Underlying Linux kernel is multi-threaded Event Loop leverages Linux multi-threading Events queued Queues processed in Round Robin fashion

Node.js Event Processing Loop

Node.js Downloading Software Download software from Node.js site: https://nodejs.org/en/download/ Supported Platforms Windows (Installer or Binary) Mac (Installer or Binary) Linux SunOS, Docker, IBM Power (AIX, Linux), IBM System z Long Term Support (LTS) Most stable version (8.11) Current Newest features (10.7)

Node.js Software Installation Windows Follow installer prompts Standard Windows installation Verified for Windows 10 Make sure to select npm if not already installed Reboot computer

JavaScript Code Editors Atom (Open Source) https://atom.io/ Eclipse (IBM) http://www.eclipse.org/downloads/packages/ Help Eclipse Marketplace Find node Nodeclipse (1.0.2) Visual Studio (Microsoft) https://code.visualstudio.com/docs/nodejs/nodejstutorial

Node.js & npm Installation Verification Launch a DOS Command Window Windows Run cmd.exe Enter the following commands: node -v npm -v (Verify Node.js installed & in Path) (Verify npm installed & in Path)

Node.js Command Line Interface (CLI) Windows.bat file to launch Command window c:\program Files\nodejs\nodevars.bat Execute JavaScript program node programname.js.js filename extension optional (assumed if not provided) Generate JSDoc from comments jsdoc programname.js HTML pages stored in./out directory

node Command (1): Syntax & Options node Program syntax node options programname.js -- scriptarguments.js is assumed if no file extension is provided node Program Options Default option is to execute the specified program. Other options include: -c --check script script.js (Syntax check program; no execution) -e --eval expression (Execute JS expression) -h --help (Command syntax help) -i --interactive (Enter interactive programming mode) inspect (Execute program in debugging mode) -p --print expression (Print JS expression result) -r --require module (Load JavaScript Module) -v --version (Display Node.js version)

node Command (2): Arguments node Command Arguments -- The Double Dash follows the script name Arguments follow the double dash Arguments are passed to the script They do NOT affect the execution of the node command

node Command (3): Environment Variables Environment variables affect command execution NODE_PATH A colon ( : ) separated list of directories to search for scripts. NODE_NO_WARNINGS A value of 1 suppresses warning messages. NODE_REPL_HISTORY Path to the file storing REPL history (.node_repl_history). NODE_EXTRA_CA_CERTS File containing additional CA Signer certificates in PEM format. OPENSSL_CONF Load an OpenSSL configuration file on startup. SSL_CERT_FILE Specify the x.509 certificate Keystore directory. SSL_CERT_FILE Specify the x.509 certificate Keystore filename.

node command (4): Object Information Display node.js Object Information node -p object (Display JSON for Object) https://nodejs.org/api/globals.html Global Objects console global os process Module Objects module require (Provides a console for stdout, stderr) (Global Namespace Object) (Operating System Object) (Current Node.js process Object) (Current Module Object) (Current required Modules)

node --print command example

Node.js Read Eval Print Loop (REPL) node Interactive Mode REPL (pronounced repple ) Invoked by: node node -i -interactive Process input lines: R ead JavaScript statement E valuate and execute statement P rint the result of the statement L oop through subsequent input lines o Terminate REPL with CTRL-C (twice) or CTRL-D (once) Special syntax: _ (Underline) represents previous expression

Node.js Debugging Mode (1) Entering Debugging Mode Launch node using inspect option node inspect program.js Add breakpoint(s) to JavaScript program debugger; statement(s) Execution at breakpoints enters REPL mode Debugging Functionality Breakpoints can be set in script ( debugger; ) Breakpoints can be set during debugging ( sb(); ) Variables may be watched ( watch(); ) Commands may be executed

Node.js Debugging Mode (2) Debug Mode Commands Define Breakpoints sb() sb(linenumber) sb( function() ) sb(script.js, #) cb(script.js, #) (Set breakpoint on current line) (Set a breakpoint at the specified line) (Set a breakpoint for start of a function) (Set breakpoint at specified script line) (Clear specified script breakpoint)

Node.js Debugging Mode (3) Debug Mode Commands - continued Command Execution ( stepping ) c, cont kill n, next o, out pause restart s, step (Resume execution) (Terminate script) (Execute next expression) (Step out of an expression) (Pause execution) (Restart script) (Step into expression)

Node.js Debugging Mode (4) Debug Mode Commands - continued Informational Commands bt, backtrace (Display expression execution history) exec(expr) (Execute expression in current context) list(#) (Display the surrounding script expressions) repl (Enter into REPL mode from current context) scripts (List all loaded scripts) unwatch(expr) (Remove expression from watch list) version (Display V8 version) watch(expr) (Add expression to watch list) watchers (Display all watchers and values)

JavaScript Linters Lint is a Code Analysis Tool There are several JavaScript Linters available JSLint One of the oldest JavaScript Linters http://www.jslint.com/ JSHint Successor to JSLint http://jshint.com/ ESLint Powerful but requires some configuration https://github.com/eslint/eslint

JSHint JavaScript Code Analysis Tool JSHint Installation npm install -g jshint Invocation jshint scriptname Configured by a.jshintrc file. Start search for file in script directory Works up the directory structure May need to modify to support ECMAScript 6 esnext : true esversion : 6

Node.js Official Documentation JavaScript API https://nodejs.org/en/docs/ node Command Documentation https://nodejs.org/dist/latestv7.x/docs/api/cli.html#cli_command_line_options Node.js Debugger https://nodejs.org/api/debugger.html Node.js Event Loop Processing https://nodejs.org/en/docs/guides/event-loop-timers-andnexttick/

Questions?