in the in Nodejs, a module divides all functions into units and provides a complete module loading mechanism. module in Nodejs is a very important concept that allows us to introduce third-party class libraries into our applications. in the in Nodejs you can write or introduce several module files:1)
When writing the node. JS Code, we often need to write our own module. At the same time, it is necessary to write the module interface at the end of the module, declaring what the module exposes externally. In fact,
Node. js advanced core module. net introduction and instance description module Overview
The net module is also the core module of nodejs. As mentioned in the overview of the http module
Tags: window mod npm htm technology share JSON test file errUnder the Windows platform, test the Nodejs connection to the MySQL database. First install the MySQL dependency package in the console At first I was in the corresponding JS located in the directory under the installation of MySQL support, the result is: When I saw so many warn, I thought I had a problem with my outfit, so I was ready for a global installation, NPM install-g MySQL There is
Compared to native JavaScript, it is difficult to share variables between different JavaScript files. In view of this, node. js expands on JavaScript, introducing the Require,exports,module three global object.I.. absolute module and Relative moduleSmashing node. JS's author
Explain the differences between exports and module. exports in Node. js, nodemodule. exports
Today I read about node. js'srequireFinally, the differences between exports and module. exports are clarified.
We know that there are two ways to expose
Often when you create a node. JS program, we need to divide the code into logical dependencies and organize it into multiple modules instead of putting the code in a single file. This is necessarily the same as in other languages, there are mechanisms like packages or modules that can be used. We look at how modules are created and used in node.
This article mainly introduces the Buffer module in NodeJS, which is very detailed. For more information, see
I. opening analysis
The so-called Buffer refers to the "Temporary Storage Zone", which is a memory block that temporarily stores input and output data.
The JS language only has the String data type and does not have the binary data type. Therefore, NodeJS provides a global constructor Buffer equiva
We know that each module corresponds to a js file. This article describes the simplest module hello. js, and then the require custom module in another js file (main. js.Hello. jsCopy codeThe Code is as follows:Function hello (name
This article mainly introduces common methods of CRYPTO in the NODE. JS encryption module. For more information, see use require ('crypto') to call the encryption module.
The encryption module requires the underlying system to support OpenSSL. It provides a security credent
Introduction and Materials
Http://nodejs.org/api/events.html
Http://www.infoq.com/cn/articles/tyq-nodejs-event
Events is the most important module of node. js. The events module provides only one events. EventEmitter object. The core of EventEmitter is event launch and event listener.
Most modules in
It is well known that node. JS is based on a single-threaded model architecture, designed to deliver efficient CPU utilization, but cannot utilize multiple core CPUs, to address this problem, node. JS provides a child_process module that enables multi-core CPU utilization th
?Create the node. JS module.
Create a folder to store module.
Cdto the newly created folder, runNPM Init,will prompt for input Packagethe information. You can follow this video to enter. the Test command can be empty. The package name cannot have capital letters, and if you want to publish it to the public, use
objectPathname: '/curse/list ',Path: '/curse/list?from=scottcourse=node ',HREF: ' Http://imooc.com:8080/curse/list?from=scottcourse=node#dloor1 '}Compare it to each other and see what's different.> Url.parse ('//imooc.com/curse/liast ', true){protocol:null,Slashes:null,Auth:null,Host:null,Port:null,Hostname:null,Hash:null,Search: ",Query: {},Pathname: '//imooc.com/curse/liast ',Path: '//imooc.com/curse/lia
BKJIA recommended topics: Node. js Zone
This article introduces the Node. js extension module Hashish. Hashish is a JavaScript Hash combination sub-database. In other words, it contains a series of data structure operation functions.
For example:
varHash=require('hashis
node. JS is a commonly used JavaScript runtime environment, this article and everyone sharing is mainly node. js in the common properties and methods of the process module, I hope that through the sharing of this article, we learn about
This article mainly introduces the Buffer module in NodeJS, which is very detailed. For more information, see
I. Opening Analysis
The so-called Buffer refers to the "temporary storage zone", which is a memory block that temporarily stores input and output data.
The JS language only has the String data type and does not have the binary data type. Therefore, NodeJS provides a global constructor Buffer equiva
, [callback])Request. setNoDelay ([noDelay])Request. setSocketKeepAlive ([enable], [initialDelay])Http. IncomingMessageEvent: 'close'Message. httpVersionMessage. headersMessage. rawHeadersMessage. trailersMessage. rawTrailersMessage. setTimeout (msecs, callback)Message. methodMessage. urlMessage. statusCodeMessage. socket
Let's start with a simple example to create a file named server. js and write the following code:
The Code is as follows:
Var ht
, [callback])Request. setNoDelay ([noDelay])Request. setSocketKeepAlive ([enable], [initialDelay])Http. IncomingMessageEvent: 'close'Message. httpVersionMessage. headersMessage. rawHeadersMessage. trailersMessage. rawTrailersMessage. setTimeout (msecs, callback)Message. methodMessage. urlMessage. statusCodeMessage. socket
Let's start with a simple example to create a file named server. js and write the following code:
The code is as follows:
Var ht
This article mainly introduces Node. in js, the Request module provides a basic tutorial on how to process HTTP requests. The request also supports OAuth signature requests, which are very powerful. If you need them, refer to the following section to introduce a Node. js
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.