My Node. js learning path (4) -- unit test and node. js unit test
NPM installation:
Npm install nodeunit-g
Supports command line and browser running. Various assertions. In node. js, modularize the method to export exports. If it
Parse the code deployment method of Node. js Based on modules and packages, and deploy node. js
Module path parsing rules
Experienced C programmers first write from the make file when writing a new program. Similarly, before using NodeJS to write a program, in order to have a good start, you must first prepare the dire
This is a special Node. js learning note for beginners. This note will show you how to Start Node. js step by step. 1. Introduction to node. js
I have a lot of information on the Internet.
1. What is
Example of using Node. js to implement RESTful API, node. jsrestful
Basic RESTful concepts
REST (Representational State Transfer) describes an architecture-style network system that first appeared in Roy Fielding's doctoral thesis in 2000. In the REST service, application status and functions can be divided into variou
This article focuses on. two key concepts of js: non-blocking IO and event loops are summarized appropriately. If you need them, you can refer to the following concepts to learn and use Node. javascript has been writing a web application and a RESTful web api using express and mongoose for two months. js official websi
Summarize some error types in Node. js and summarize the node. js types.
Preface
Multiple types of errors may occur in Node. js applications. For example, if a syntax error or runtime error occurs, a JavaScript error is triggered.
Node. js Study Notes (2)-modularization, node. js Study Notes
Welcome to reprint, but please indicate the source: http://blog.csdn.net/sysuzjz/article/details/43987289
Thanks: nodebeginner.org
An application consists of different modules. Now we will introduce these modules
Node. js has to say 12 points. node. js has to say
1. node. js: javascript on the server side. It allows javascript code to be run on the backend (out of the browser environment.
2. event-driven, asynchronous I/O programming mode
, your portal script is named "app. coffee ", then execute:
Copy codeThe Code is as follows:Coffee app. coffeeNote that the coffee extension here cannot be omitted.
This method should be the most "official" way to use coffeescript. Simple, direct! In addition, once you use a coffee file as the project portal, the entire project will be compatible with both coffee and js. You can use any require js or coffee
don't know livewired, you should know that you can use the JScript language (1996) or Rhino in ASP. But until the 2009, these server-side JavaScript technology and the same application on the server side of Java, PHP, compared to appear relatively pale.When it comes to the origins of node. js, it's inevitable to talk to its founder, Ryan Dahl. In 2009, the servi
Hypermedia is a technology that uses a non-linear mesh structure to organize and manage massive multimedia information (including text, images, and videos. The concept of hypermedia is similar to that of hypertext in the early days. The essence of hyper-media is to add links to the text content, which constitutes hyper-text. The same is true for hypermedia. Both hypermedia and hypertext are transmitted over HTTP, which means that hypermedia can be acc
file is index. js, and index. js will be loaded. If index. js does not exist, loading will fail.
Assume that the directory structure is as follows:
Package. json is defined as follows:
Copy codeThe Code is as follows:{"Name": "pack ","Main": "modA. js"}
At this time, requi
1.1.61023
When we think we have captured the lagging behavior, we can run the following code to stop the analyzer:
slc ctl cpu-stop 1.1.61023
Run the following code to write a file to the hard disk:
CPU profile written to `node.1.1.61023.cpuprofile`, load into Chrome Dev Tools
Okay, that's it. You can load the file into Chrome for further analysis as in the V8 analyzer.
Make the right decisionIn this article, I show three ways to capture CPU usage in
Node. js common module collection and node. js collection
It collects some common modules in NodeJS development.MVC Framework-Express
Express is a lightweight and flexible Nodejs Web application framework that can quickly build websites. The Express framework is built on the
This article mainly introduces Node. in js, the event transmitter mode is used to implement event binding. This article also explains the basic knowledge of callback mode, transmitter mode, and event type. For more information, see Node, many objects launch events. For example, a TCP server will launch a "connect" event whenever a client requests a connection. Fo
, we have to define it again:
The code is as follows:
App. use (function (req, res, next ){Object. defineProperty (req, 'IP ',{Get: function () {return this. headers ['X-iisnode-REMOTE_ADDR '];}});Next ();});
This problem is finally solved, but this is not a good method. it would be too difficult if Express sets req. ip to read-only in the future.
Continue the test and find another problem. Normally, the file upload function in the blog background uploads files to the public/upload directory,
Node. js supports multi-user web Terminal Implementation and security solutions, and node. js supports multiple users
As a common feature of local IDE, terminal (command line) supports git operations and file operations of projects. For WebIDE, without a web pseudo-terminal, only the encapsulated command line interface
Detailed description of Node. js in Wondows using the MongoDB environment configuration, node. jsmongodb
A database is usually required to store Website user data and business data. MongoDB and Node. js is a perfect fit, because MongoDB is a document-based non-relational dat
version management: no subshells, no profile setup, no convoluted API, just simple.
Install n
It is very easy to install n. It is an NPM module. Therefore:
npm -g install n
Use and settings
To use n to install a specific version of node, you only need the following command:
N stable # Install the latest stable version n lts # Install the latest LTS version n 6.9.0 # Install a specific v6.9.0
After multiple versions are installed, enter the n command
Node. js debugging skills, node. js debugging
Author: zhanhailiang Date:
1. console. log
Similar to front-end debugging, code debugging is performed by printing related variables step by step.
2. Use the Node. js built-in Debugger
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.