This article describes how to use socket in Node. js to create private chat rooms and public chat rooms. For more information, see:
In the previous article, we will introduce the use of Angular, Nodejs, and socket. i/O builds chat rooms and multi-user chat rooms. This article continues to introduce Node. use socket in js
(), Warning Console.warn (), Error message Console.error ().For example, insert the following four lines in the Web script:
Console.info ("This is Info");
Console.debug ("This is Debug");
Console.warn ("This is warn");
Console.error ("This is Error");
When loaded, the console displays the following content.Can see, different nature of the information in front of the different icon
In the professional software development process, no matter what platform language, now UnitTest is required. Node. js has the Assert of built-in. Today, let's take a look at the Node. js unit test. Here we use nodeunit for NPM installation:
Npm install nodeunit-g
Supports command line and browser running. Various ass
This article mainly introduces the node. js game sharing that allows multiple users to move their mouse online at the same time. This article provides the server and client code and running methods. For more information, see the recent project requirements, so I studied the websocket Implementation of nodejs, socket. io, which is a widely used framework of nodejs background applications websocket.
Preparat
Three file writing methods for Node. js and three write methods for node. js
This article describes three methods for writing files in Node. js.
1. Write files through the pipeline streamUsing pipelines to transmit binary streams
This article describes how to get the Buffer object byte length from the Node. js practical code segment. For more information, see what we know under the Node. js framework.
Buffer objectIt can provide good support for binary data, so it is necessary to obtain the actual length of bytes of a Buffer object. The
Node. js crawls Chinese webpage garbled issues and solutions, node. js Chinese webpage
When Node. js captures a non-UTF-8 Chinese webpage, garbled characters may occur. For example, if Netease's homepage code is gb2312, garbled ch
defined in this file. The user list is displayed here.
Continue to add:Copy codeThe Code is as follows:Http. createServer (app). listen (app. get ('Port'), function (){Console. log ('express server listening on port' + app. get ('Port '));});Finally, create an http server and start it. This is almost the case.
(The above content is complete in the new template generated by express, and you do not need to write it yourself)
Now we can write something
Today thick cheeky to recommend next I write a small plugin bar.Read my blog should be familiar with this plugin, in fact, this is the goods.This thing I wrote last year, when the level is not good, but somehow still realized the simple function.Let me start with a brief introduction of this thing.Because in the Forum, blog writing things, very much want to have a running function, of course, most of the current functions are open implementation.And there was no
By default, the transmission process of Nodejs read/write stream is transmitted in the form of buffer, unless you set other encoding formats for it. For details, refer. The stream in Node. js is very powerful. It provides support for processing potential large files and abstracts data processing and transmission in some scenarios. Because it is so easy to use, we often write some tool functions/libraries ba
Describes how to configure npm and webpack in node. js, node. jsnpm
Overview
Node. js is written in c ++. It is a javascript running environment based on the chrome V8 engine. It disconnects javaScript running from the browser server. It can be used to write server code.
1.
This article mainly discusses and verifies whether forEach () in node. js is synchronous or asynchronous, and shares ideas and methods with you. if you need it, you can refer to it. Almost all callback functions in node are asynchronous. the code behind the callback function may be executed before the code in the callback function is executed, especially for data
This article describes how to use node + vue. js to implement SPA applications. For more information, see
Business Requirements
Recently, the company asked to develop a web version of the app. Because the app is content-oriented and has a chat module, it is not suitable for multi-page development, and it is mainly for mobile browsing, it is harsh for loading speed or user experience. After researching a lo
In the past, alert was used to view the execution of js Code. Today, I saw a friend using the console. log function prints the output function, variable, and object. The following figure shows the console. log usage records the execution status of js Code when I debug the co
');}Var dir = function (object ){Var util = require ('til ');Process. stdout. write (util. inspect (object) + '\ n ');}Var time = function (label ){Times [label] = Date. now ();}Var timeEnd = function (label ){Var duration = Date. now ()-times [label];Exports. log ('undefined: nanm', label, duration );}Var trace = function (label ){// TODO probably can to do this better with V8's debug object once that is// Exposed.Var err = new Error;Err. name = 'tr
This article mainly introduces relevant information about the Community version of Node. js static file server. If you need it, please refer to it. First of all, thank github for providing the source code on github. Compared with last night's static file server, it is a little more complex and can learn a lot of new things.
The Code contains a fs. stat function and the pipe function of the ReadStream obje
Node. js loop traps and node. js loop traps
The asynchronous mechanism of Node. js is implemented by events and callback functions. It may feel like a violation of the Conventions at the beginning, but it will be very easy to get
Node. js emitter. emit method instructions, node. js Use Cases
Method description:
When an event is triggered, several optional parameters are passed to the parameter table of the event listener.
Syntax:
Copy codeThe Code is as follows:Emitter. emit (event, [arg1], [arg2], [...])
Receiving parameters:
Event Type
Arg1 ~
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.