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 applications (〇)
This article corresponds to the first part of the original article, Chapter
Label: The MongoDB node. JS Driver is officially supported by the native node. JS driver, and he is by far the best implementation and has been supported by MongoDB official. The MONGODB team has adopted the MongoDB node. JS drive
without first understanding the underlying transmission mechanisms of Nginx and Node. js, and performing targeted optimization, it may be futile to tune the two in detail. In general, Nginx uses TCP socket to connect the client to upstream applications. Our system has many threshold values and limits on TCP, which are set through kernel parameters. The default v
web developers. With its powerful features, developers can create single-page and multi-page, and mixed-mode WEB applications.4) Koa JSThis node. JS Framework was developed by the Express team. Kao.js is the next generation of tools designed to create a lighter, more expressive, and solid foundation for WEB applications and APIs.5) Locomotive JSLocomotive supports the MVC pattern, and REST-style routing is
preparedness. The clustering mechanism of MongoDB's replica set overcomes this flaw. Replica Set: Mainly divided into: primary (master node, provide additions and deletions to change services), Slaver (Standby node. Just provide read), arbiter (quorum node, does not store data, is solely responsible for quorum). Process: Client reads and writes data from primary
The GitHub address for node. JS is: Https://github.com/nodejs/nodeOfficial website Source package: https://nodejs.org/en/download/① get and compile the source code (git is already installed)git clone https://github.com/nodejs/node.gitCD nodegit CheckoutCompile:./configureThere was an error when compiling:4.8 3.4 (cxx=g++)Tip C + + compiler g++ version is too old.Solution (refer to: How to upgrade GCC under
("./circle.js");//require通过引入模块文件,找到exports对象提供的接口console.log("The area of a circle of radius 4 is " + circle.area(4));Writing a slightly larger program typically blocks the code. In NodeJS , the code is generally reasonably split into different JS files, each file is a module, and the file path is the module name.When writing each module, there are require、exports、module three pre-defined variables available for use.The module name can use a relative
Compare buffersCopy bufferRouting means that we have different ways of dealing with different URLs, such as handling/start business logic and dealing with/upload modules, and logic isis inconsistent.Node. JS Module System:http://www.shouce.ren/api/view/a/3470Code area:/** * Compare buffers * Buf1.compare (BUF2);*/varBuffer1 =NewBuffer (' ABC ');varBuffer2 =NewBuffer (' ABCD ');varresult =Buffer1.compare (buffer2); Console.log (result);if(Result ) {Con
Label:ObjectiveFrom the installation of the environment in the native (win8.1) environment to finish this demo about less than two weeks, just started in the local installation environment and did not knock a demo, from the beginning of the weekend and intermittent to write a, according to the inertia of thinking to write a deletion and change to check it, One is to experience the magic of node. JS, and the
? Too low, or use Express, can make your life better, medium complexity6, Commander 1692 packagesSimilar to Optimist7, Coffee-script 1620 packagesCoffee-script8, Colors 1290 PackagesA library of colors displayed under UNIX terminals for debugging and special scenarios9, MKDIRP 910 PackagesCreate a target folder at once, not a pattern like mkdir...cd...mkdir...cd...mkdir10, Lodash 901 PackagesSimilar to underscore, more lightweight, faster11, Uglify-js
On the bus to brush micro-bo, or there are many students in consultation:
How to quickly build a node development environment
NPM Super Slow
Issues that GitHub cannot open
So I think I should write an article to answer all these starting questions, so that the new students can also smooth the start.Quickly build a node. JS development enviro
REST + MongoDB build service side, front end is HTML + CSS + JS + Jquery (at that time the front end is not used MVC), server when IIS.Our project name is "based on XXXX Service", later, the results are good, took a good result. I think the practice of WCF is quite cool, and later in the senior company internship also made a point of WCF services. Specific practices such as:The whole project is not elaborate, mainly to say the separation of practice,
BackgroundThe node. JS community recently burst into a hole at the American Independence Day weekend spreehttps://medium.com/@iojs/important-security-upgrades-for-node-js-and-io-js-8ac14ece5852First, give a piece of code that will trigger the vulnerabilityRun directly on the
BackgroundThe node. JS community recently burst into a hole at the American Independence Day weekend spreehttps://medium.com/@iojs/important-security-upgrades-for-node-js-and-io-js-8ac14ece5852First, give a piece of code that will trigger the vulnerabilityRun directly on the
API in Node. js. I hope it will be useful to you.
Features
Event-based communication
You can use pipe to connect to a stream.
Type
Readable Stream Readable data Stream
Writeable Stream writable data Stream
Duplex Stream bidirectional data Stream, which can be read and written simultaneously
Transform Stream converts data streams, which are readable and writable,
fully understand, and the Foundatio N necessary to build additional functionality into your app. And we ' ll do it in about minutes of installation and coding. Is that awesome? I submit that it is.
Let ' s go. Part i–15 MINUTES of installing
If you are really starting from scratch, then getting everything the up and running takes a little bit of time. None of it is difficult. I Run Windows 8 on me main machine, so it ' ll be slightly different for those on a Mac or Ubuntu or other *nix system,
module in node. js that manages the routing response request and returns the appropriate HTML page based on the requested URL. Here we use a pre-written static page to return to the client, just use Express to specify the path of the page to be returned. Without this package, we need to write the HTML code together with the background JavaScript code in response to the request, which is not very convenient
of node. js to connect MySQL, the first step is to install a npm called MySQL package, the package is officially provided, stability is guaranteed, of course, there are other NPM packages, here we only use MySQL package. The installation method is very simple, the input command npm install MySQL--save, waiting for the download to complete.See this look, that is
However, it is reported that Microsoft has contacted the Node. js official website and I believe it will be improved soon.If Cygwin is not installed, can I build a Node. js environment on Windows for trial development? I made a simple test with Node.
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.