If you're writing the node. JS code, Node-inspector is a must-have option, much better than node. JS's built-in debugger. It's similar to Chrome's JavaScript debugger.To install with NPM:$ npm install -g node-inspectorThen you need to connect to
Node. js is based on Google V8, and Google V8 has an Eclipse debugging plug-in that also supports node. js.
1. Install Eclipse debugger for V8
This should be known to anyone who has used Eclipse, but let's simply put it:
Select "Install New Software"
Click "Add"
Location: http://chromedevtools.googlecode.com/s
11. Node. js asynchronous Process Control (sequential mode, concurrency mode, and limited concurrency Mode)
In terms of basic syntax, Javascript is no different from most other C-derived languages. You may easily go from other languages to Javascript. Many users who transfer
This article mainly introduces Node. in js, the event transmitter mode is used to implement event binding. This article also explains the basic knowledge of callback mode, transmitter mode, and event type. For more information, see Node
good News: Now we can debug node. js with our browser!!!Premise
node. js 6.3+, which can be downloaded on the node. JS website;
Chrome 55+. If your local chrome is upgraded
devtool to replace existing tools such as Nodemon.--watchThis command will be launched in the console of the Chrome Developer tool, and the app.js --watch files we saved will be re-loaded (automatically) to the console via the parameters.By clicking app.js:1 on the link, the program will take Sources us to the relevant line in the tag.In the Sources tag, you can also tap the Cmd/Ctrl + P button to quickly search through all dependent modules. You can even review and
It seems that fs. watchfile is not supported in Windows. I don't want to use iis node, so I spent some time writing a tool to help debug.
This tool can do the following:
Monitors changes to all subdirectories in the main js file. restarts the Node process after changes are made.
Logs can be output to this tool for view
Using Webstrom can easily debug the Node applcation.For example, we had an node+express application.Server.js:/**/' use strict '; var expres = require (' Express '); var app = expres (); App.get (function(request, Response) { response.send (200 , "Hello World"); App.listen (3000);All it does just send back a "Hello world" string.What we want are to see how to
Debugging node. js with Chrome DevToolshttps://nodejs.org/en/docs/guides/debugging-getting-started/1.PS c:\users\clu\documents\nodeapp\test> node--inspect. \app.jsDebugger listening on WS://127.0.0.1:9229/34C03922-857B-4E6D-82CF-30DBF27A76FFFor help, See:https://nodejs.org/en/docs/inspectorServer running at Http://127.0.0.1:3000/2. Open the About:inspect in the C
VS code is a Microsoft produced a cross-platform of the lightweight editor, I do not advertise, want to know their own to search it, in short I like it.: https://code.visualstudio.com/Installation is completed should be automatically added to the environment variables, do not remember, if you do not add the environment variable. Installation finished directly see version:VS code opens the site created in the previous article Rc_web (optional below)
Direct desktop shortcut icon launches vs
Leadership to find a conversation, the company is not mixed, said to think clearly after the direction of development what. Just think of node. js.First of all, look at the introduction, the general understanding of node. js, Baidu Search is indeed a lot of chaos, feeling or know the point. Attach the known topic node.
, Removealllistener , emit and other basic methods of event monitoring mode implementation.It is not the same as the events on the front-end DOM tree, because it does not have event bubbling , layer-wise capture, and other events that belong to the DOM, nor Preventdefault (), Stoppropagation (), Stopimmediatepropagation () Methods for handling event delivery.From another point of view, the event listener pattern is also an event hook mechanism that
Document directory
Understanding callback Mode
Understanding event transmitter Mode
Understanding event types
Use the event transmitter API
Create an event Transmitter
For the list of articles in this series and the translation progress, see Node. js advanced programming: using Javascript to build scalable app
test by the core developers and users shows that it works well: The request connection is now evenly distributed. There is also a plan to turn the selection algorithm into a configurable or plugin-based approach.If you want to fall back to the previous assignment method, you can set the Cluster.schedulingpolicy:var cluster = require (' cluster '); // Set This before calling and other cluster functions. Cluster.schedulingpolicy = cluster. Sched_none;cluster.fork ();or use the NODE_CLUSTER_SCHED_
. It inserts a callback function into the event queue to wait for a response, and executes the callback function as soon as possible. OK, let's take a look at a function that functions as a cross-element of two arrays:1 functioncompute_intersection (arr1,arr2,callback) {2 varResults = [];3 for(vari = 0; i)4 for(varj = 0; j){5 if(Arr1[i] = =Arr2[j]) {6 Results.push (Arr1[i]);7 Bareak;8 }9 }TenCallbackNULL,true); One}View CodeWhen the elements in m
Today I have nothing to think of node. js, so I downloaded a node. JS installer to the web for installation. whichSetup: Node-v0.11.13-x64.msi PC system: Windows 7 Custom installation path: D:\TOOLS\NodeJsAfter the installation is complete, execute: d:\tools\nodejs>
This article mainly introduces what is Node. js? What are the advantages of Node. js ?, To try to explain what Node is. js, this article will briefly introduce some background information: the problem to be solved, how it works, h
with global module ):
Copy codeThe Code is as follows:Npm install supervisor-g
Assume that the main portal of your Node. js program is app. js, you only need to execute the following command to start monitoring file changes.
Copy codeThe Code is as follows:Supervisor app. js
The Supervisor also supports multiple param
propName or obj ['propname'> method to find the object attributes but fail to search for them. hasOwnProperty ('propname') is used to search for attributes in the prototype object. If the property does not exist in the prototype chain, the undefined value is returned.
Let's use the following example to illustrate:
if (typeof Object.create !== 'function') { Object.create = function (o) { var F = function () {}; F.prototype = o; return new F(); };var otherPerson = Object.create(person
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.