IntelliJ Idea Development node. js

Source: Internet
Author: User

Now it seems that the idea of the development of node. JS is not too much to explain, today tried, unexpectedly succeeded ....

1. Installing Nodejs

http://nodejs.org/download/automatically downloads its own version of node. JS according to the system

2. Environment variables

Windows installation, no need to configure environment variables
After the MAC is installed, you will be prompted to configure the environment variables, you need to configure the environment variables (seemingly)
Command sudo vim/etc/paths
Enter password
And then enter the path in,

3. Whether the test was successful

Console input node-v or input node in node mode and output Console.log (1);

See if there's a reaction.

4. Configuration Tools

Idea is a powerful software as described in his name, as well as the homepage of the official website. Now idea also supports the development of node. JS: http://www.jetbrains.com/idea/features/nodejs.html

A, by default, the idea is installed, and on the right of the file--setting->plugins, the default is no need for this component you manually click on Browe repositories: To search for node in the plugin list, you will see the node plugin, Click to download

Must be restarted after installation is complete.

B. You can see 2 options for node in Create project.
node. js boilerplate base Template
node. js Express App website

Just choose the first one.

C. After opening the project. You need to configure node because it is already installed. So idea automatically found the installation file. Now you need to download the node source code, provide smart tips or other functions with

You can go to the website to download and select this file. or download it directly, and choose to download it in advance.

After the installation is complete.

5. Write a demo

Examples are copied from the node. JS Book.

node. JS is definitely written in the JS file. So create a new JS. Paste the Code

var http = require (' http '); http.createserver(function(req,res) {    Res.writehead ( 200,{' content-type ': ' text/html '});    Res.write (' );    Res.end (' <p>hello f</p> ')}). Listen (in);     // Event Monitoring 3000 port console.log (' open 2s ');

Click to complete the configuration as follows:

Run after configuration. See Console output Open2s

Open page Http://127.0.0.1:3000/to see results

IntelliJ Idea Development node. js

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.