Express author TJ said goodbye to Node. js and rushed to Go, tjnode. js
First, this is a Farewell Node translated from TJ. js. After reading this article, I have indeed suffered some impact, but I do not agree with some of the author's views, such as I think
result.
This program calls the http module provided by node. js, replies the same content to all Http requests, and listens to port 3000. After the script is run, it does not exit immediately. You must press ctro + c to stop it. This is because the listen function creates an event listener.
4. debug the script
After the node
If it is a JS effect, check the code for Console.log and other debugging code, ie in normal mode does not execute the console methodIf you do spa application, data is not updated please add in Ajax header' Cache-control ': ' No-cache ', ' if-modified-since ': ' 0 ' I was in the development of the Vue.js-based spa when data was not updated to discover this problem!When the website is running under IE, what i
Node. js is a magic horse? To put it simply, it is a framework for implementing JavaScript running locally, including a js language interpreter (V8) and some class libraries. With it, you can use the js language to develop some local applications, so that js is not bound by
Description of the fs. fstat method in node. js, node. jsfs. fstat
Method description:
Obtain the file information based on the file descriptor.
Syntax:
Copy codeThe Code is as follows:Fs. fstat (fd, [callback (err, stats)])
Because this method belongs to the fs module, we need to introduce the fs module (var fs = require ("fs") before use "))
Receiving parameter
Description of the fs. utimesSync method in node. js, node. jsfs
Method description:
The file timestamp is modified in synchronous mode.
Syntax:
Copy codeThe Code is as follows:Fs. utimesSync (path, atime, mtime)
Because this method belongs to the fs module, we need to introduce the fs module (var fs = require ("fs") b
modules will still be available.2.0 of the PlanNotadd 2.0 will be developed based on Nodejs, while providing features and features that are not available in 1.0.Why the NodeJS?
Performance: In IO-intensive operations, NodeJS can easily implement 5W concurrency with asynchronous non-blocking mechanisms, while Laravel is only 200.
Convenience: NodeJS can easily install the extension, and PHP needs to pecl or phpize even recompile, which is not familiar with the environment of the dep
disableadvancedoptimizations-selectorpropertymerging, reduction,etc.compatibility-forcecompatibilitymodetoie7 orie8.Defaultstonotset.debug-settotrue Togetminificationstatisticsunderstatsproperty (seetest/custom-test.jsforexamples) */ Functioncssminifier (filein,fileout) {varorigCode= " ,finalcode=[];for (vari=0;i
Perform compression
Node Compress.js can perform compression manually
You can also write to the batch comman
. when js loads,. js is loaded. At this time, B. a. js will also be updated to complete the object. In fact, I think it may be similar to. js references .)Core modules)
Some modules in node are compiled into binary. These modules are described in more detail elsewhere in the
Paip. Build a connection to mysql in the node js environment of the best scripting language
#=== Download node... take eleven exe... Easy... 1
#0 ---- Hello world. js 2
# --------- Create and use the module... 2
1. ## -- Call (Load file module --- normal file module 3
2.) 3
3. ##--- load the built-in Module 3
4. ##--
a time, completing theThat is, enter the event loop to check and process the subsequent events. In this way, the CPU and memory will only handle one event at a time and allow time-consuming I/O operations to be executed in parallel.The disadvantage is that it does not conform to the traditional developers to become thinking, often need to put a complete logical split into a single event, increase the OpenThe difficulty of the hair and commissioning.4.console.log () is equivalent to C's printf (
node. js Debug JavaScript configuration1. First download the node. JS installation package to nodejs.org and install it. 2. Open the Sublime Text editor. Select Menu Tools--Build system--New build system ... 3. Save the file as Javascript.sublime-build 4. The file cont
the JS module file in node. js and the JS file loaded by the script tag is that the variables declared in node. JS's module file are within the closure, do not pollute the global environment, and need to be externally called interfaces to hang on the exports.>> event mechan
suspended (the debugger tag is equivalent to opening a breakpoint in the Code ). The Code is as follows:
var path = url.parse(req.url).pathname;debugger;res.writeHead(200, {'Content-Type': 'text/plain'});
Run the command: node debug example. js to enter the debugging mode.
In deb
complete:tarDecompress:
#tar-zxvf node-v4.0.0-rc.1.tar.gz
Wget nodejs
Install Node JS v4.0.0
Now you can use the downloaded source code to compile Node. js. Before compilation, you need to switch to the decompressed directory of the source code on ubuntu server and run
node. js, a server-side JavaScript that allows JavaScript code to run on the backend (out-of-browser environment).
The programming mode (single thread) of event-driven, asynchronous I/O is its core.
node. JS's JavaScript engine is V8, from Google Chrome projects. V8 claims to be the fastest JavaScript engine in t
create the folder like so: Mkdir-r C:\USERS\SOMEUSER\APPDATA\ROAMING\NPMWhy use Visual Studio 2013? Node Tools for Visual studio!With node. js installed, it ' s time to select a development tool. Of course, you is free to use any editing tool want and why use a glorified notepad when you can experience the full Power of Enterprise-grade integrated development en
side of the browser, you have to do input validation. Traditional mode is the need to write a Java classmate, the front-end students to write a copy. Because node and Java are both deployed in a server cluster or an area, you can trust a data between the two sides. Verification from the browser, you can share the form input verification, to achieve cost-saving purposes.The above is from a push Web service
this side of the browser, you have to do input validation. Traditional mode is the need to write a Java classmate, the front-end students to write a copy. Because node and Java are both deployed in a server cluster or an area, you can trust a data between the two sides. Verification from the browser, you can share the form input verification, to achieve cost-saving purposes.The above is from a push Web ser
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.