Sir, your Nodejs (0)

Source: Internet
Author: User
Tags php language

today, Our topic composition is Nodejs, I try to describe it is: similar, but it is not the same existence. It is a world in which the beauty of a unique body is more attractive. Perhaps just do not understand, perhaps time will give the answer, Nodejs you deserve to have.

  1. Really understand the concept of JS as a server-side development language

in Web development, we are familiar with the JS code is generally related to css,html and so on in our ASPX or HTML or JSP page, they are generally written in a type of page class, when we visit a page, They are parsed and rendered by the browser, showing the content of the browser page we see. This is the client JavaScript inside of our concept.

In Nodejs, as the server-side language of JavaScript, he does not pinned to the page class, he as a server-side writing code of a language, through the JS encoding, return data to the client. This way, the server-side JS, can be described as similar to the java,php language in the back end of the role, used to write back-end logic code, (with java,php such a language function), and then return the data through response to the client. The javascript here is the server code that exists as the response data.

Note: The site is built on the server
When a client accesses a server-side page, the backend code (Java) is run on the server. But Js,html,css is parsed on the client browser side.

The following are the roles that the client JS plays:
Client (user action)------> request (with customer's information)---------> Server side
Client (resolution display after the browser gets data) <----------response (data js,html,css) <------server side (receiving customer information and requests, server-side logic processing (that is, running the associated java,php program))

Under the Nodejs platform, JavaScript can act as a location for Java (PHP). This is the server-side JS.

  2.REPL mode

  The first time to see this repl four letters, feel very tall on the appearance, the heart inexplicable will have a feeling is that this east can take out to play a fool. In fact, you can try to translate or imagine the original word and Chinese meaning.

Read-eval-print Pool, meaning read, execute, loop output.

This is what it means to wait for your input, then perform the parsing in time, and then return the results to show. Such a process of continuous circulation. Press CTRL + C twice in a row to exit Repl mode

Example:

After installing the Nodejs installation package, the Nodejs installation path is automatically added to the environment variable path. This means that you can use the Nodejs command-line tool (Node.exe) to enter the installation directory where you install Nodejs. In the Nodejs command-line tool (the cmd command line of the window System), enter REPL mode and the immediate evaluation environment is opened in the current context.

  3. Development of debugging gadgets supervisor

  When you develop an application for node. JS Implementation, you will find that no matter which part of your code you modify, you must terminate node. js and rerun it to work. This is because Nodejs only parses the script file the first time it is referenced to a section, and then accesses the memory directly, avoiding repeated loading. Nodejs This design, while improving performance, is not conducive to debugging. Because we always want to see the effect as soon as we change it in the development process.

Install Supervisor:
NPM install-g Supervisor
Next Use the Supervisor command to start
Supervisor Helloworld.js

Patterns in the Next:nodejs

Sir, your Nodejs (0)

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.