Installation of NVM1. Download the installation package, https://github.com/coreybutler/nvm-windows/releases2. After the download is complete, click on Nvm-setup, follow the steps to install, note that the path can not take spaces and Chinese path, where my installation is D:\DEV\NVM3. After the installation is complete, configure the environment variables. When the latest version of the software is installed, variable names and variable values are automatically generated in the user variables o
Front-end aspectsI used backbone.js to do the front-end development, the impression is that the backend by the properties of the model object to send the JSON data, I write in the template rendering is good
Template loading (underscore.js)
Building a model
Render View
Routing, events, etc.
Back-end aspectsThe two days of contact with Nodejs, originally intended to use Backbone to do the front-end structure, and then use the
Download Nodejs engine, 32bit version or 64bit Version
Download the latest version of npm Zip Format Compressed Package: http://nodejs.org/dist/npm/
in a location on the hard disk, such as F create a file under disk Nodejs , put the above two downloaded things here, NPM to decompress.
Configure two environment variables: one is path Span style= "; font-family: Add node.exe d:\
operations and provides much clearer code.
Third time:Although the small file merge solution is feasible, it feels silly after all. If it is a very large file, it can be imagined that the merge and traversal are slow, and the management is not convenient. Therefore, if it can solve the problem of writing stream by offset in Nodejs, it can be solved. I flipped through the node. js document and found that w and w + were used in the past to open the fil
node. JS is a platform built on the Google Chrome JavaScript execution environment that allows JavaScript to run out of the client browser, giving JavaScript the ability to have a server language. We can use Nodejs to quickly and easily build Web applications that are easy to expand. With event-driven, node. js, the non-blocking I/O model becomes lightweight and efficient, making it ideal for data-intensive, real-time applications running on distribut
node. JS is a platform built on the Google Chrome JavaScript execution environment that allows JavaScript to run out of the client browser, giving JavaScript the ability to have a server language. We can use Nodejs to quickly and easily build Web applications that are easy to expand. With event-driven, node. js, the non-blocking I/O model becomes lightweight and efficient, making it ideal for data-intensive, real-time applications running on distribut
Js has a nodejs. Our Technical boss sent a technical email some time ago saying that php supports multithreading, Asynchronization, and non-blocking, and said that nodejs should be destroyed, on the official website, swoole's performance is already at least comparable to that of nodejs. We need to use data to talk about it. We can test these two items when we are
About the require path in NodeJS
Learning Nodejs is also out of curiosity about this new product, and there are two important projects that require his support. Therefore, you should study this new language well. In nodejs, modules can be divided into core modules and file modules. The core module is compiled into binary code. Only the require identifier is requi
Main applicability of nodejsNode. js is a platform that can quickly build network services and applications [1]. The platform is built based on Chrome's JavaScript runtime. That is to say, it encapsulates the GoogleV8 engine (applied to Google Chrome.V8 cited worker to execute Javascript very quickly and with very good performance. Node optimizes some special use cases and provides an alternative API to make V8 run better in a non-browser environment.
Install
First, we use NodeJs to build a basic server.
Index. js
Copy codeThe Code is as follows: var requestHandler = require ("./requestHandler ");
Var server = require ("./server ");
Var route = {
"/Hello": requestHandler. hello,
"/Upload": requestHandler. upload
};
Server. start (route );
Server. jsCopy codeThe Code is as follows:
Server. jsCopy codeThe Code is as follows: var http = require ("http ");Var url = require ("url ");Exports. start = function (r
Use the captchapng module in Nodejs to generate an image verification code,
The Nodejs project encountered a problem when performing image verification code. Nodejs does not have a picture library. It will be available in the future, but it does not exist now.
There are several solutions to search around the network:
1. Use a third-party verification code program
node event mechanism13 Types of TimersThere are three types of timers in the Nodejs: timeout time, time interval, instant timer1. Time-out: SetTimeout (Callback,delaymilliseconds,[args]) method, such as:SetTimeout (myfunc,1000);The settimeout function returns the ID of a timer object that can be passed to cleartimeout () at any time before Delaymilliseconds expires to cancel the time function. var mytimeout=settimeout (myfunc,1000);... cleartimeout (m
0. PrefaceWhy do you use node?Node uses non-blocking IO as a way to improve application performance. In JS, there is an innate asynchronous programming mechanism: the event mechanism. There is no multi-process in JS at the same time. This will not block the task of the main process when you perform a relatively slow IO operation that takes a long time.There are two ways to manage the response logic in Nodejs: Callback, Event listener.
Callbac
Before has been on the Internet to see the topic of Nodejs, because of their own more like this aspect of the content, the period is also a concern, and now finally decided to calm down to learn her.This is the first day, install the Nodejs and build a simple example. (My system is WIN8)1. First, download the NODEJS program. Address http://www.nodejs.org/download
My first Nodejs program: Hello World var http = require ("http"); Http.createserver (function (request, response) { Response.writehead (200, {") Content-type ":" Text/plain "}); Response.Write ("Hello World"); Response.End ();}). Listen (8000); Console.log (' Server is runing at http://127.0.0.1:8000 ');Record the installation process:
Go to http://nodejs.org/download/download the appropriate installation package, I downloaded this node-v0
has been dedicated to front-end development, in recent days, began to learn the Nodejs. As a front-end developer, it is very exciting to see such a background written in JavaScript. However, backstage is different from the front end, in the process of learning, or will encounter a lot of problems.
In order to start learning Nodejs, a first choice of "Simple Nodejs
has been dedicated to front-end development, in recent days, began to learn the Nodejs. As a front-end developer, it is very exciting to see such a background written in JavaScript. However, backstage is different from the front end, in the process of learning, or will encounter a lot of problems.
In order to start learning Nodejs, a first choice of "Simple Nodejs
First we use Nodejs to build a basic server first.
Index.js
Copy Code code as follows:
var RequestHandler = require ("./requesthandler");
var server = require ("./server");
var route = {
"/hello": Requesthandler.hello,
"/upload": requesthandler.upload
};
Server.start (route);
Server.js
Copy Code code as follows:
Server.js
Copy Code code as follows:
var http = require ("http");
Two ways of solving1. You can configure MySQL connection poolvar mysql = require(‘mysql‘);var pool = mysql.createPool({ host: ‘localhost‘, user: ‘nodejs‘, password: ‘nodejs‘, database: ‘nodejs‘, port: 3306});var selectSQL = ‘select * from t_user limit 10‘;pool.getConnection(function (err, conn) { if (err) console.log("POOL ==> " + err); conn.
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.