Header Microsoft Virtual Academy Introduction to Node js


Global Packages on Windows


Download 1.73 Mb.
bet3/5
Sana08.05.2023
Hajmi1.73 Mb.
#1442354
1   2   3   4   5
Bog'liq
downloads mastering node.js, part 1 - introduction

Global Packages on Windows

  • Are global to the user, not the system
  • Does not require administrative privileges

Globally Installed Packages are stored in:
C:\Users\\AppData\Roaming\npm

Global Packages on Mac and Linux


On a Mac by default, Globally Installed Packages are stored in:
/usr/local/lib/node_modules

Fixing Permissions for Global Packages


https://docs.npmjs.com/getting-started/fixing-npm-permissions

Managing Packages with NPM

Building a Simple Web Server

  • One of the core modules for Node.js is the HTTP module, which provides a web server and web client
  • The web server is very flexible, but requires a lot of boiler plate coding to build even the simplest applications
  • Commonly, other packages such as Express or Hapi are used to configure the web server
  • Web server are I/O intensive applications making them well suited for Node.js
  • Node.js is great for web servers because of its easy handling of JSON data

Building a Simple Web Server

Reading Files from Disk

  • Node.js allows full access to the system (such as accessing the file system), unlike a web browser which only allows sandboxed access
  • Accessing file system resources can be synchronously and asynchronously
  • Synchronous access can be used for initial program loading, but only asynchronous access should be used during program operation
  • Both text and binary data can read and written
  • Full support for streams

Reading Files from Disk

Debugging Node.js

  • Node.js comes with a built in command line debugger, but its limited
  • Instead, there are many code editors and other tools which greatly simplify debugging of Node.js applications
    • StrongLoop's Node Inspector (free – Windows/Mac/Linux)
    • Microsoft Visual Studio Code (free – Windows/Mac/Linux)
    • Microsoft Visual Studio with Node.js Extension (community edition free – Windows only)
    • GitHub's Atom with Node Debugger Package (free – Windows/Mac/Linux)
    • JetBrains' WebStorm (not free – Windows/Mac/Linux)
  • These IDEs provide the standard fare of debugging tools such as breakpoint, call stacks, watches, and local variables

Download 1.73 Mb.

Do'stlaringiz bilan baham:
1   2   3   4   5




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling