This article focuses on the definition and description of node. js, as well as 10 scenarios for node. js to let you know where node. js can be applied, and now let's look at this article.
First we need to know what node. js is?
What is node. js (actually learning Web server development)
1. is a JS runtime environment (simply can parse, execute JS code): Not a language/library/framework
(1) JavaScript in node. JS does not have a BOM, DOM, only ECMAScript (basic syntax) because the server does not manipulate the page
(2) In node this JavaScript execution environment for JS to provide some server-level operation API (file read and write, build network services, network communication, HTTP server, etc.)
2. Features: Use event-driven, non-blocking IO models (asynchronous in simple terms), lightweight and efficient
3. Most JS-related packages are on NPM
For example, with NPM, a single command can be used in different libraries/frameworks (such as jquery) without having to download the library/framework's official web
second. what node. js can Do
1.Web Server Backend (Java, PHP do node. JS can Do)
2. Command-line tools
Note 1: The BS programming model for any server-side technology is the same, and language-independent
Note 2:node No HTML files, only. js files
Now count the 10 scenarios of node. JS:
1.Web Development: Express + EJS + mongoose/mysql
Express is a lightweight and flexible Nodejs Web application framework that allows you to build websites quickly. The Express framework is built on the Nodejs built-in HTTP module, and re-wraps the HTTP module to the actual Web request processing functionality.
Ejs is an embedded JavaScript template engine that generates HTML code by compiling.
Mongoose is a MongoDB object Model tool that allows access to MONGODB operations through the Mongoose framework.
MySQL is the communication API that connects to MySQL database and can be used to access MySQL operations.
Web development is usually done with Nodejs, which requires 3 frameworks to work with, like SSH in Java.
2.REST Development: Restify
Restify is a Nodejs-based rest application framework that supports both server-side and clients. Restify is more focused on rest services than Express, removing the template and render features in Express, while reinforcing the rest protocol usage, versioning support, and HTTP exception handling.
3.Web chat Room (IM): Express + Socket.io
Socket.io One is a software package based on NODEJS architecture that supports websocket protocols for communication at all times. Socket.io provides a complete package for cross-browser building of real-time applications, and Socket.io is fully implemented by JavaScript.
4Web Crawler: Cheerio/request
Cheerio is a fast, flexible, and packaged jquery core functionality toolkit specifically tailored for servers. Cheerio includes a subset of the jquery core, which removes all DOM inconsistencies and incompatible browser parts from the jquery library, revealing its truly elegant API. Cheerio work on a very simple, consistent DOM model, parsing, manipulating, rendering is incredibly efficient. The base end-to-end benchmark shows that the cheerio is approximately eight times times faster than the Jsdom (8x). The Cheerio encapsulates @fb55-compatible htmlparser and is capable of parsing virtually any HTML and XML document.
5.Web Blog: Hexo
Hexo is a simple, lightweight, node-based static blogging framework. With Hexo we can quickly create our own blogs, which can be done with just a few commands.
At the time of release, Hexo can be deployed on its own node server, or it can be deployed on GitHub. For individual users, the deployment on GitHub is a lot of good, not only to eliminate the cost of the server, but also reduce the various system operations of the trouble (System management, Backup, network). So, the GitHub-based personal site is starting to pop up ....
6.Web Forum: Nodeclub
Node Club is a new community software developed with node. JS and MongoDB, which is elegant, feature-rich and small and fast, and has been applied in the node. JS Chinese technology Community CNode, but you can use it to build your own community.
7.Web Slideshow: Cleaver
Cleaver can generate markdown-based presentations. If you already have a markdown document, you can make it into a slideshow in 30 seconds. Cleaver is the tool prepared for hacker.
8. Front-end package management platform: bower.js
Bower is a package management tool launched by Twitter, based on Nodejs's modular thinking, to spread functionality across modules, to connect modules and modules, and to manage this connection between modules through Bower.
9.OAuth Certification: Passport
The Passport project is a Nodejs-based, certified middleware. Passport is intended only for "login Authentication", so the code is clean and easy to maintain and can be easily integrated into other applications. Web applications generally have 2 types of login authentication form: User name and password Authentication login, OAuth authentication login. Passport can configure different authentication mechanisms according to the characteristics of the application. This article will introduce, user name and password Authentication login.
10. Timer Task Tool: Later
Later is a Nodejs-based tool library that performs timed tasks in the simplest way. Later can be run in node and in the browser.
This is the introduction of node. JS and there are 10 scenarios. Students who want to learn the direction of node. JS can go to Topic.alibabacloud.comNode.js to study manuals