variety of environments. (What is the V8 JavaScript engine?) Please "Baidu know")4. Third-party extensions and modules play an important role in the use of node. The download NPM,NPM is the management tool for the module, which installs various node packages (such as Express,redis, etc.) and publishes the packages that are written for node.Install nodeIn this brief talk about installing
Mainly used for debugging, displaying information, focusing on examplesIn browser JavaScript, the window is usually a global object, and the global object in node. JS is# # #__filename__filename represents the file name of the script that is currently executing. It will output the absolute path to the location of the file, and the file name specified with the command-line arguments is not necessarily the sa
, using var variable can be output by Console.log ().REPL command
Ctrl + C?- exits the current terminal.
Ctrl + C Press two times ?- Exit Node REPL .
Ctrl + D?- exits Node REPL.
Upward / downward Key ?- View the history command of the input
Tab Key ?- List Current Commands
.help?- list the Use commands
.break?- exit multi-line expressio
with a Promises monitor.Tip: In the experiments interface, if you tap the Shift key 6 times, you will be exposed to some even more experimental (unstable) features.--consoleYou can redirect the console output to the terminal ( process.stdout and process.stderr ). It also allows you to import it into other processes, such as TAP prettifiers, by using a pipeline.| Tap-spec--Andprocess.argvYour script can be parsed like a normal
node. JS-based automation Tool GulpWhat is Gulp?Gulp is a stream-based code-building tool in the front-end development process, and it is the building block of the automation project; she can not only optimize the site resources, but also in the development process a lot of repetitive tasks can be automated using the correct tools, she can not only very happy to write code, and greatly improve our efficienc
, scalable, suitable for real-time data interactive application6, single process, single threadWhat can node. js do?1. Web sites with complex logic2. Large-scale WEB applications based on social networks;3. Web Socket Server (page tour, Web IM);4, TCP/UDP socket application;5, command line tools;6, interactive terminal program;7. Local application with graphical
, scalable, suitable for real-time data interactive application6, single process, single threadWhat can node. js do?1. Web sites with complex logic2. Large-scale WEB applications based on social networks;3. Web Socket Server (page tour, Web IM);4, TCP/UDP socket application;5, command line tools;6, interactive terminal program;7. Local application with graphical
the terminal and enter node -v it, and you should see the following output:$ node -vv7.6.0If the version number is less than the v7.6.0 node. JS version is incorrect, the code in the later sections is not guaranteed to work correctly, please reinstall the latest version.Npm
follows:
D: \ blog> node appExpress server listening on port 3000
When the browser is opened, the following response is returned:
Here we use express (a popular nodeJSweb development framework) and the ejs template engine.
File structure
The directory structure of the initialization file is as follows:
App. js is the entry file
Package. json is a module dependent file. When we use npm install, it downlo
The node. js REPL (Read Eval Print Loop: Interactive interpreter) represents a computer environment, similar to a Window system's terminal (CMD) or unix/linux shell, where we can enter commands in the terminal and receive a response from the system.Node comes with an interactive interpreter that can perform the followi
9/4/10 by Felix Geisendörfernode. JS has generally caused II reactions in people I ' ve introduced it to. Basically people either "got it" right away, or they ended up being very confused.If you have been in the second group so far, this is my attempt to explain node:
It's a command line tool. You download a tarball, compile and install the source.
It Let's run JavaScript programs by typing '
node for a long time, update the node version quickly, or switch the node version quickly, in a non-Windows (such as osx and linux) environment, use nvm to install your node development environment to keep the system clean.
If you use Windows for development, you can use nvmw to replace nvm.
1.1 install nvmw
1.1.1. cl
I've been interested in learning more about node. JS recently. This is a server-side programming of the Java platform that allows developers to write Java code on the server, and many CentOS users are trying to learn the language's development environment. This is exactly what I want to do with this tutorial.First, make sure you have CentOS 7. Because it is the only version I am using, of course there is no
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 npm Details One, NPM introductionInstall NPM Please read the predecessor's article, very detailed introduction.The full name of NPM: Node package Manager.(1) Popular understandingIn fact, you can literally understand what this product does, translating it into "node package manager." Yes, that's a management t
, scalable, suitable for real-time data interactive application6, single process, single threadWhat can node. js do?1. Web sites with complex logic2. Large-scale WEB applications based on social networks;3. Web Socket Server (page tour, Web IM);4, TCP/UDP socket application;5, command line tools;6, interactive terminal program;7. Local application with graphical
are created to listen to port 8888 Server
Three rows (in parentheses): An anonymous function has two parameters: one request and one response.
Line 4: when receiving the request, use the response. writeHead () function to send an http status 200 and content type of the http header (content-type)
Row 5: You can use the response. write () function to send the text "Hello World" in the http body and use the response. end () function to complete the response. Response. end (text) is used for mergin
Official notes1.NodeJS declared its goal to be "designed to provide a simple way to build scalable network programs."2.node is a lightweight, scalable JS operating environment with event-driven and non-blocking I/O mechanisms based on the Chrome V8 engine for code interpretation.The 3.node is suitable for projects with high concurrency requirements and is suitabl
BodyWhen I introduce someone to node. js, there are usually two kinds of reactions, either immediately figuring out what it is, or being confused by it.If you're still in the latter, here's my node explanation:
It is a command line tool, you can download a tarball file, compile and then install the source file;
It allows you
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.