browser.
2. Create your own module
The namespace in node. js is independent.
Use require to introduce methods or variables of another module in one module
• Introduce the fnData Module
require("./fnData");
• Import and Export (export variables or functions)
module.exports = {myFn:test.myFn,a:test.a}
2. built-in modules
Nodejs built-in modules include Buffer, C/C ++ Addons, Child Processes, Cluster, Console
Create simple chat rooms for Node. js and simple chat rooms for node. js
I read about TCP and wrote a NET-based chat room.
Var net = require ('net'); var count = 0, users ={}; var server = net. createServer (function (conn) {console. log ('connection'); conn. write ("\ r \ n> welcome to
Brief Introduction to node. js version control nvm and n, node. jsnvm
Today's topic includes two parts
1. Use nvm or n for version control under node. js2. After the node. js version is installed on nvm, restart the
In-depth understanding of the node. js http module, and in-depth understanding of node. js
The http module is mainly used to build an HTTP server and client. The HTTP module must be called to use the http server or client functions.
Create a server
Var http = require ("http"); var url = require ("url"); // create a ser
Nothing to do, study a node. js, although there are a lot of resources on the Internet tutorial, but it is not as good as the memory of their own handwriting to the deep.Create a node server The first step: Download the node. JS installation and configure environment variabl
Leadership to find a conversation, the company is not mixed, said to think clearly after the direction of development what. Just think of node. js.First of all, look at the introduction, the general understanding of node. js, Baidu Search is indeed a lot of chaos, feeling or know the point. Attach the known topic node.
Example of Node. js readline Reading and Writing File Content line by line, node. jsreadline
This article describes the two implementation methods of reading data row by row using readline. The details are as follows:
What is Readline?
Readline is an encapsulated module for implementing standard input and output in Node
application development, for example, we can test whether a package is working properly, invoke one of the application's modules separately, perform simple calculations, and so on.3.1.3 Establishing an HTTP servernode. JS server architecture and PHP architecture Create a file named App.js with the following code:var http = require (' http '); http.createserver(function(req, res) { Res.writehead ( {' Content-type ': ' text/html '}); Res.write (
write a very simple terminal program to test whether the installation is successful and works properly. To do this, we will create a "test. js" file, which contains the following code:
root@ubuntu-15:~#vimtest.js
var util =require("util");
console.log("Hello! This is a Node Test Program");
:wq!
Now, in order to run the above program, run the following comm
8888 Port //terminal prints the following information Console.log ( ' Server running at http:// 127.0.0.1:8888/' ); In this way, a simple HTTP Server, even if it is finished, the input node app.js can be run, and then access will see the output results.Why use node. jsFace a new technology, ask a few why is always good. Since PHP, Python, and Java can all be
configuration file zabbix_agentd.conf and add other configurations.
Include=/App/zabbix/etc/zabbix_agentd.conf.d/*.conf
8. Copy Zabbix Agent Configuration
cp pm2-zabbix/install/zabbix-agent/pm2-zabbix.conf /App/zabbix/etc/zabbix_agentd.conf.d/pm2.conf
9. modify the configuration pm2.conf content sudo-u user and step 4th are consistent, colleagues modify the pm2-zabbix path
UserParameter=pm2.processes,sudo -u root /usr/local/bin/pm2-zabbix --discover
10. Add the sudo configuration for the server
files to any web host.
In contrast, installing node. js is easy. You can download the installer or use the Package Manager. Next, let's create a Web page in Hello.js:
var http = require (' http '); Http.createserver (function (req, res) { Res.writehead ($, {' Content-type ': ' text/ Plain '}); Res.end (' Hello world! ');}). Listen (3000, ' 127.0.0.1 ');
Before accessing Http://127.0.0.1:3000/in a browser
or terminal, and the server receives the request and returns the response data.1. Introduction of Node JS moduleUse the require directive to load the HTTP module and assign the instantiated HTTP value to the variable http:var http = require (' http ');2. Create a service#!/usr/bin/env node//require instructions to loa
the following contents: var http = require (' http ' function // send HTTP header // HTTP Status value: 200:ok // content type: Text/plain response.writehead ($, {' Content-type ': ' Text/plain ' // send response data "Hello World" Response.End (' Hello world\n ' 8888 // terminal prints the following information Console.log (' Server running at http://127.0.0.1:8888/'); Open cmd and switch to the Test.js directory:Open Browser, type
Understanding node. jsPosted on 29/4/10 by Felix Geisendörfernode. JS has generally caused II reactions in people I ' ve introduced it to. Basically people either "got it" right away, or they ended up being very confused.If you have been in the second group so far, this is my attempt to explain node:
It's a command line tool. You download a tarball, comp
Install node. js and ubuntu14.04node. js in ubuntu14.04
After checking on the Internet, a node-v0.12.7-linux-x64.tar.gz file is first downloaded, decompress it in the/home/node path, and add the following command to/etc/profile:
Export NODE_HOME =/home/
, installing node. js is easy. You can download the installer or use the Package Manager. Next, let's create a Web page in Hello.js:var http = require (' http '); Http.createserver (function (req, res) {Res.writehead ($, {' Content-type ': ' Text/plain '}); Res.end (' Hello world! ');}). Listen (3000, ' 127.0.0.1 ');Before accessing Http://127.0.0.1:3000/in a browser, you need to enter
Recently, I want to find a lightweight service development platform that supports rapid development. I chose Node. js, there were several options at that time: Python + Django (using Django, although the development is fast, but the performance is not very good ). Ruby + ROR ). Node. js. Now that you have selected
10 comparison challenges for PHP and node. js
In the recent sitepoint of PHP vs node. js SmackDown, Craig Buckler compares the two languages on how to respond to a series of 10 challenges to determine which is better overall.
These comparisons are always contradictory, Craig says in his book. As an interesting follow
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.