First learn about node
Node.js is a JavaScript runtime environment based on the Chrome V8 engine.
Node.js uses an event-driven, non-blocking I/O model, making it lightweight and efficient.
npm, the package manager for Node.js, is the world's largest ecosystem of open source libraries.
Excerpted from ( http://nodejs.cn/ )
The following is a personal understanding
First of all, node is a javascript running environment, which is analogous to the jre java running environment of java. With node, we can make the javscript code not only run on the browser, but also run on the node, as long as the installed node environment can run the javascript code,
Then node is an event-driven, non-blocking I/O model. When the request arrives, the node will not block reading the local file and continue to accept subsequent requests. When the reading of the local file is completed, the operation after reading the file will continue. This is a unique feature of JavaScript, event callback
Learn more about express
Express is a fast, open and minimal web development framework based on the Node.js platform.
web application
Express is a minimalist and flexible web application development framework based on the Node.js platform. It provides a series of powerful features to help you create various web and mobile device applications.
Excerpted from ( http://www.expressjs.com.cn/ )
Using express can quickly build a web application without writing cumbersome http modules
install node
http://nodejs.cn/download/download and install
install express
npm install express --save
The details of the installation are written on the official website in great detail.
http://www.expressjs.com.cn/starter/installing.html
After installation is complete
Create an app.js file
var express = require('express'); var app = express(); app.get('/', function (req, res) { res.send('Hello World!'); }); var server = app.listen(3000, function () { var host = server.address().address; var port = server.address().port; console.log('Example app listening at http://%s:%s', host, port); });
node app.js // start the server
Open browser http://localhost:3000/
You can see a web page helloworld