Home > Backend Development > PHP Tutorial > Installation and testing of nodejs environment on mac

Installation and testing of nodejs environment on mac

WBOY
Release: 2016-07-28 08:27:30
Original
990 people have browsed it

A summary

Everyone who has worked as a web server before knows that both nginx+lua and the popular node.js can be used as web servers. The former is more troublesome than the latter in terms of program writing and configuration, but They are all similar in use. Here I suggest that if you don’t know the Lua scripting language, you can learn more about this scripting language. It is known as the scripting language with the highest execution efficiency among all scripting languages. The bottom layer is based on C language, which is very Easy to use, cross-platform!
Next, I will configure the node.js environment for you.

Second configuration of mac node.js environment

Step 1: Open the terminal and enter the following command to install Homebrew

ruby -e “$(curl -fsSL
https://raw.githubusercontent.com/Homebrew/install/master/install);
 mac 上nodejs环境的安装与测试

Step 2: Install node, enter the following command in the terminal

brew install node
 mac 上nodejs环境的安装与测试

Step 3 to view node installation Success or not

node -v
 mac 上nodejs环境的安装与测试

The above three steps node is successfully installed

Three program test

Step 1: Create a new file test.js

 mac 上nodejs环境的安装与测试

Step 2: Use the terminal to find it Run in the directory where it is located

 mac 上nodejs环境的安装与测试
 mac 上nodejs环境的安装与测试

Step 3: Access through the browser and return data in json format

 mac 上nodejs环境的安装与测试

Step 4: The front end can parse the data by calling this interface, and can The current page displays data.

End of three

Isn’t it very simple? If you have done web service interface development before, this should be familiar, and it is even very simple.

').addClass('pre -numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadeIn(1700); }); });

The above introduces the installation and testing of the nodejs environment on mac, including the relevant aspects. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template