can edit and compile it in vs2013.Of course, you can also directly use the node-gyp build command to compile.The test js program is as follows: The Code is as follows:Var hello = require ('./hello ');Console. log (hello. hello ());Some problems were encountered, as shown below:1. C: \ Users \ Administrator. node-gyp \
within our node. js app.
Here's an example for finding documents within a collection specifically in this case to find all female users.
// app.jsdb.users.find({sex: "female"}, function(err, users) { if( err || !users) console.log("No female users found"); else users.forEach( function(femaleUser) { console.log(femaleUser); } );});
Notice how our initial query is a near duplication of the correspondin
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
suffix can be omitted; start with "/" with an absolute path to load, ". /"starts ".. /"starts ". /"indicates files under the same directory,
The file suffix mentioned above can be omitted. The priority js file to be loaded by Nodejs is> json File> node File
Create a custom Module
Take a counter as an Example
The Code is as follows:
Var outputVal = 0; // output valueVar increment = 1; // incremental/* Se
directly enter the node environment, and enter console. log ("hello world! ") Test console Node console output
Test Node
Create a testnode. js file on the machine running
completed the setup, but you don't know if it can run correctly, let's write an example file to test it.
Create example. js in the C: cygwin directory
Input
Var http = require ('http ');
Http. createServer (function (request, response ){
Response. writeHead (200, {'content-type': 'text/html '});
Response. end ('Hello World');
}). Listen (8888 );
Console. log ('server running at http: // 127.0.0.1: 8888 /')
In node. js, q. js is used to implement api promise. node. jsq. js
About what is promise and promise solution is what problem, please experience node callback asynchronous encoding method, along with the step http://wiki.commonjs.
will reference the Model, that is, the data persistence mechanism, to perform the curd operation on the data table, coming soon...
Ps: Node. js and Sails ~ Log Mechanism
When you see the logs of Sails, you will think of log4net. Indeed, they are similar in many places, and they all adopt the hierarchical record method. I think sails is more convenient to use, it does not require us to do more things, but d
Node. js debugging skills, node. js debugging
Author: zhanhailiang Date:
1. console. log
Similar to front-end debugging, code debugging is performed by printing related variables step by step.
2. Use the Node.
Installation and Configuration tutorial for node Debug tool jshintFont: [Increase decrease] Type: Reprint time: 2014-05-27 I want to commentI'm not going to brag about node's advantages, it makes it possible for JavaScript to unify the front and back of the web. But for beginners, the server side of the JS code may not be as good as the client side of the code de
path.
Node. js Website: http://nodejs.org/
Enter the tar xf node-v0.4.7.tar.gz in the Command window, node-v0.4.7.tar.gz for your own version.
Enter the cd node-v0.4.7 in the Command window and press Enter.
Enter./configure in the Command window and press Enter.
Enter make
:
The Code is as follows:
Var buffer1 = new Buffer (8 );Buffer1.write ('nice to meet U', 'utf8 ');Var buffer2 = new Buffer (8 );Buffer1.copy (buffer2 );Console. log (buffer2.toString (); // nice to meet u
Stream module
In UNIX operating systems, stream is a standard concept. There are three major streams:
1. Standard Input2. standard output3. Standard Error
Readable stream
If the buffer zone is the method by which
Node Debug Path-----jshint I'm not going to brag about node's advantages, it makes it possible for JavaScript to unify the front and back of the web. But for beginners, the server side of the JS code may not be as good as the client side of the code debugging, intuitive. The debugging of client-side JS code has basical
This article describes how to build a Node. js development environment in Linux. Node allows JavaScript programs to be explained and run in the local operating system environment. For more information, see
1. install node. js in Linux
Ubuntu:
sudo apt-get install nodejs np
This article mainly introduces Node. this article describes the features and application scenarios of js. js's asynchronous IO, event loop and callback functions, single-thread, cross-platform features, and then summarizes its use scenarios. For more information, see Node. js should be one of the hottest technologies t
Use C ++ to write extension modules for node. js and node. js extension modules
Prerequisites: Install node. js, Python2.7, and visual studio 2013.
Process:Install the GYP project generation tool npm install-g
This article mainly introduces Node. js module loading details. This article describes how to load core modules, file modules, directory modules, and file Loading modules, for more information, see JavaScript, one of the most frequently used programming languages in the world. It is a common language in the Web world and used by all browsers. JavaScript was born in the era of Netscape, and its core content
This article mainly introduces Node. js module loading details. This article describes how to load core modules, file modules, directory modules, and file Loading modules, for more information, see JavaScript, one of the most frequently used programming languages in the world. It is a common language in the Web world and used by all browsers. JavaScript was born in the era of Netscape, and its core content
This article mainly introduces node. use q. js implements api promise. promise is a standard that describes the returned results of asynchronous calls, including correct returned results and error handling, need a friend can refer to what is promise and promise solution is what problem, please experience node callback asynchronous coding method, along with the st
This article analyzes and explains node through several examples. the use of require in js is very detailed. Here we recommend that you provide a very clear description in the code comments. Here we will not talk nonsense about it. We will provide the Code directly:
The Code is as follows:
/* In node, you can use the require () function to load modules.* The r
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.