Getting to know Node JS
Others
2021-03-22 00:32:32
views: null
One, NVM
nvm
Can switch node
version management node
, download address https://github.com/coreybutler/nvm-windows/releases
, as follows:
nvm-noinstall.zip
: Green free installation version, but it needs to be configured when using it.
nvm-setup.zip
: Installed version, recommended
nvm
Common commands are as follows:
nvm list
See all current node
versions
nvm install v10.13.0
Install the specified version
nvm use -delete-prefix 10.13.0
Switch to the specified version
Two, NodeJS and JS
ECMAScript
,As follows:
- It defines the syntax, writing
JavaScript
and nodejS
must comply
- Variable definition, loop, judgment, function
- Prototype and prototype chain, scope and closure, asynchronous
- Can not operate
DOM
, you can not monitor click
events, you can not send ajax
request
- Can not process
http
the request, the file can not operate
- Only
ECMAScript
, can hardly do any actual projects
JavaScript
,As follows:
- Use
ECMAScript
syntax specification, plus web API
indispensable
DOM
Operation, BOM
operation, event binding, Ajax
etc.
- Combine the two to complete any operation on the browser side
nodeJS
,As follows:
- Use
ECMAScript
syntax specification, plus nodejS API
indispensable
- Processing
http
, processing files, etc., learninghttp://nodejs.cn/api/assert.html
- Combination of both, to complete the
server
end of any operation
- The summary is as follows:
ECMAScript
Is a grammar specification
nodeJS = ECMAScript + nodeJS API
Three, server side and front-end development
server
The difference between front-end and front-end development is as follows:
- Service stability
- Consider memory and
CPU
(optimization, expansion)
- Logging
- Safety
- Cluster and service split
- Service stability is as follows:
server
The end may be subject to various malicious attacks and misoperations
- A single client can hang up unexpectedly, but the server cannot
PM2
Wait for the process
- Consider memory and
CPU
(optimization, expansion) as follows:
- The client exclusively a browser, memory, and
CPU
not a problem
server
The end has to carry a lot of requests, CPU
and memory is a scarce resource
stream
Write the log, using redis
depositsession
- The log records are as follows:
- The front end will also participate in writing the log, but it is only the originator of the log and does not care about the follow-up
server
The end needs to record logs, store logs, and analyze logs. The front end does not care
- There are multiple logging methods and how to analyze the logs
- Security, as follows:
server
The end must be ready to receive various malicious attacks at any time, while the front end must be much less
- For example, unauthorized operation, database attacks, etc.
- Login authentication, prevent
XSS
attacks and sql
injection
- The cluster and service are split as follows:
- Product development is fast, traffic may increase rapidly
- Carry large traffic by expanding machines and service splitting
- Support service splitting in design
Origin blog.csdn.net/weixin_42614080/article/details/110675774