Home  >  Article  >  Web Front-end  >  Node.js (install, start, test)_node.js

Node.js (install, start, test)_node.js

WBOY
WBOYOriginal
2016-05-16 16:45:181184browse

Concept

Node.js is a platform built on the Chrome javascript runtime that makes it easy to build fast, scalable web applications. Node.js uses an event-driven, non-blocking I/O model, which makes it more lightweight, efficient and perfect for data-intensive real-time applications running across distributed devices.

Installation

Here we mainly introduce the simplest and most convenient installation method based on the windows platform. We first directly visit the node.js official website http://www.nodejs.org/, and directly click the Install button to start the download and installation. .

Click the Run button to start

Continue clicking the Next button

Check Accept and click the Next button directly

Select the installation directory and click Next

Select the functions that need to be installed. Here we keep the default installation status and click the Next button

Click Install and wait for the installation to complete

Click the Finish button to end the installation

Start Node.js

Two ways:

1. Click the application icon from the start menu to launch

2. Enter node directly through the command line to enter the node environment, enter console.log ("hello world!") to test the console Node console output

Test Node

Create a testnode.js file on the machine running Node.js and enter the following test code

Then store testnode.js to a certain disk directory, open the node.js command line, switch to the node.js test code directory, enter the node testnode.js command in the command line, a firewall warning window appears (due to the firewall settings), don’t panic, just click the Allow Access button to allow it to run.

Note: The author entered testnode.js directly for the first time in a daze, and the result was a running exception, which was very embarrassing. The main reason was that the author was not familiar with node.js. The exception is shown in the figure below. As long as you enter the node run command correctly, you can avoid this exception.

Then open the browser and enter the browsing address: http://127.0.0.1:3000 or http://localhost:3000 to run the testnode.js file.

The operation effect is as follows:

Okay, everything seems to be running normally. That’s it for today’s preliminary exploration of Node.js. I will further record my learning process in future articles. Thank you.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn