node. JS Learning has been nearly a year long, since the beginning, can meet a variety of problems, take the installation, always encounter strange problems, but every time Google, or Baidu, can find a solution, gradually developed Baidu or Google's fault! Normal installation The first step: Download the installation file . Step two: Install Nodejs. after the download is complete, double-click
Areas of expertise in Node. js are:
Does not require many operations
High throughput requirements
Lightweight and fast incoming messages
Low outgoing message and fast request
The online examples are socket. io. I have been wondering where I can use it? Based on the advantages of node. js (fields of expertise), I
Update-g ExpressIii. creating a project using Express1. Create a projectExpress App_nameExpress defaults to Jade as the template engine2. Create a project with Ejs as a template engineExpress-e app_name3. Installing dependent PackagesGo to the project folder and execute:NPM InstallDownload all dependent packages recorded in Package.json to the Node_modules folderIv. Start-up service1. StartNPM startListen to the Bin/www file, the default port is 3000
leaked to usersApp.use (function (err, req, res, next) {Res.status (Err.status | | 500);Res.render (' Error ', {Message:err.message,Error: {}});}); App.listen (3000); [HTML] View plain copy on code to see a snippet derived from my Code slice var user = require (". /models/user.js "); Module.exports = function (APP) { App.post ('/updateusers ', function (req, res, next) { User.updateusers ({ sql: "Update user SET username=?,password=?,age=?,info=?") WHERE id =? ", params: [Req.body.username,
Node. js uploads images through ajaxIn this phase, the node is used for the remaining time in the night. js + mongdb + express + jade to implement a blog website of your own. You need to upload images to post a blog and embed them in the markdown editor implemented by using
Front-end newcomers, self-taught front-end for half a year, is an entry. But I have no idea about the backend. if I want to know the backend knowledge and help my future work, I 'd like to learn Node. js or PHP. I 'd like to ask some people to give me some advice. Don't tell me to learn both of them. I will learn one and I will learn the other at a time. first, I will learn one. Front-end newcomers, self-ta
Iii. using node. js for Web Development1. Install Express Express is the officially recommended Web development framework and is very powerful.Enter NPM Install-g Express on the command line for global installation Express This means that the installation is complete. But at this point we do not succeed in executing the express-h command, because express4.0 will need to install the Express-generator p
.
Buffer Merge SyntaxThe syntax for the Node buffer merge is as follows:Buffer. Concat(list[, totallength]) ParametersThe parameters are described as follows:
List-the array of Buffer objects used for merging.
totallength -Specifies the total length of the merged buffer object.
return valueReturns a new Buffer object with multiple members merged.InstanceVarBuffer1= New Buffer(' Node
()));
Because the v8: String: New () method can only accept char pointer as the value, we need to use obj-> s _-> c_str () to obtain it.
In this case, you should create a build directory in the plug-in folder.
Test
Now we can test our plug-in. Create a test. js file and necessary compilation library in our plug-in directory (you can skip the. node extension directly ):
var addon = require('./build/Release/
( ' Databack '); } });} Object {1: "11111"}object {1: "11111", 4: "44444"}object {1: "11111", 3: "33333", 4: "44444"}object {1: "11111", 3: "33333", 4: "44444", 5: "55555"}object {1: "11111", 2: "22222", 3: "33333", 4: "44444", 5: "55555"}Object { 1: "11111", 2: "22222", 3: "33333", 4: "44444", 5: "55555"}Add print events and event triggers to the program, and all the data is set and then printed,Although there is a problem with the lock locking of count, the actual problem has been solved;U
the installation was successful.11. Install the relevant environmentNPM Install Express-g NPM install Jade -g npm install MySQL -GAfter we enter node, we can enter:Console.log ("hello,world!");Test it.12. Create an app folder under the C drive and write a test.js in the app folder.The code is as follows:var http = require ("http"); Http.createserver (function(req, res) { 200, {" Content-type ":" Text/html
Node. js is a magic horse? To put it simply, it is a framework for implementing JavaScript running locally, including a js language interpreter (V8) and some class libraries. With it, you can use the js language to develop some local applications, so that js is not bound by
current working directory
PROCESS.ENV Environment variables
Process.exit exit
Signal Volume
Sixth Chapter TCPTCP
Connection-oriented, IP-based protocol
The IP protocol is out of order, TCP sends the IP containing the identifier and the data flow sequence information
byte-oriented character and character encoding are completely ignorant, good flexibility
Reliability three times handshake, window time re-hair
Flow control, speed control for receiving and
current working directory
PROCESS.ENV Environment variables
Process.exit exit
Signal Volume
Sixth Chapter TCPTCP
Connection-oriented, IP-based protocol
The IP protocol is out of order, TCP sends the IP containing the identifier and the data flow sequence information
byte-oriented character and character encoding are completely ignorant, good flexibility
Reliability three times handshake, window time re-hair
Flow control, speed control for receiving and
Label: First, Node + Express Environment Construction 0, go to node website to download and install node, if you install NPM and node, then install the Global express,-g Global installation NPM Install Express –g 1. Then use Express to create the project, Command: Express project name Initialize a
node. JS Getting Started" Gateway node. JS Course "Rapid setup of the node. JS development environment and accelerating NPMHttp://fengmk2.com/blog/2014/03/node-env-and-faster-npm.html"
out.Look at one more: Nw.js at first glance, we don't know what this thing is doing,But if you know what it turns out to be: Node-webkit, you might want to remember.We all know that the kernel like Chrome and Safari is WebKit, while Node-webkit is equivalent to a custom WebKit kernel browser that executes server-side code node
node. js File Systemnode. JS provides a set of UNIX-like (POSIX)-compliant file manipulation APIs. The Node import file System module (FS) syntax is as follows:var=require("FS") Asynchronous and synchronousThe methods in the node. js
I have no knowledge of node. js, pure white one, want to learn the original intention is to understand what node. js is what, can use it to do something, white is the curiosity. Next, record your learning process.Note: If you have any errors, please indicate that you learn from each other. Segmentfault StackOverflowWho
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.