Nodejs+express+jade Configuration

Source: Internet
Author: User

1, install nodejs, such as installed in E:\program Files\nodejs (this is my installation path).

Ensure that there are two environment variables

User Environment Variable: C:\USERS\ADMINISTRATOR\APPDATA\ROAMING\NPM

System Environment Variables: E:\Program Files\nodejs

2, installation express, with stable version of 3.5.0, the online information is mostly based on this version, do not specify the version, the default installation of the latest version

Run cmd, npm install-g [email protected]

If it is 4. X version, then install NPM install-g express-generator (if not installed will report "express" is an external command)

3, Express Installation successfully, You can use the command line to create a test app

Run cmd, Express MyApp

4. Copy the dependent module to the root directory of myapp,
Can be copied manually: copy the E:\Program files\nodejs\node_global\node_modules below the Express directory to the app root (pro-test)
You can also execute commands: cmd, CD e:\program files\nodejs\myapp->npm install

5. Install the template engine jade, install Jade to the currently created app below

Run cmd, CD e:\program files\nodejs\myapp, npm install Jade

6. Start myapp, Default url:http://localhost:3000

Run cmd, CD e:\nodejs\myqpp, NPM start or node test.js

Test.js content is

var http=require ("http");

Http.createserver (function (req,res) {
Res.writehead (200,{"content-type": "text/html"});
Res.write ("Res.write ("<p>hello world</p>");
Res.end ("<p>beyondweb.cn</p>");
}). Listen (9999);
Console.log ("nodejs Start listen at Port 9999.");

7, in the browser access open Address http://127.0.0.1:9999/, display Welcome page

Nodejs+express+jade Configuration

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.