current position:Home>About node JS server related concepts
About node JS server related concepts
2022-04-29 16:28:09【pigman】
Server and client
A server is a machine that provides network services , By installing special software ( Or run a special piece of code ) To provide services .
The server = The computer + Can give other computers / The software that the device provides services
Client and server : The service is provided by the server , It is the client that enjoys the service
The type of server
Depending on the service , The types of servers are also different :
- web The server . install apache, tomcat, iis, Or in nodejs Environment write code To provide : Picture view , News browsing .... And so on .
- ftp The server . install serv-U Software , Provide file downloads for other computers , Shared services .
- database server . install mysql Software , Provide database services for other computers . ....
web The server :
- Users enjoy... Through the browser web Services provided by the server
- We use it url Address To access a web Resources on the server
- The browser initiates a request ,web After the server receives the request , In response to this request , And return the result to the browser
ip Address
Full name :internet protocol address effect : Mark a network device , If you want to visit him, you have to find his ip
classification :ipV4 ipV6
Format :[0-255].[0-255].[0-255].[0-255]
There are four 0-255 The numbers make up ( With ip4 For example ). In the same network , The computer IP It's not allowed to be the same , It's all unique .
domain name
domain name :ip The alias of the address , because ip Bad address memory , Just give them an alias .localhost This domain name refers specifically to 127.0.0.1 This address . Domain name resolution system : Translate the domain name into Ip Address system .
port
One IP The port of the address can have 65536 individual , Range is from [0,65535]). Different ports are occupied by different software , To provide different services . Multiple servers can be used to install software , such as Web service 、FTP service 、SMTP Service etc. . obviously , Just passed ip Addresses cannot distinguish between different services .
- To provide services, the server must pass Specified port
- Both the server and the client need to communicate through the port
- Ports are programmable
- Some port numbers are reserved .
- http: 80
- https:443
- mysql:3306
use http Module write a simple web The server
// 1. introduce http modular
const http = require('http');
// 2. Create services
const server = http.createServer(function (request, response) {
console.log(' Here we are ')
// Send content to the client
res.end('123321');
});
// 3. Start the service
server.listen(8000, function () {
console.log(' Start the server ');
});
Copy code
Start the server first
Then enter the port , The effect is as follows
copyright notice
author[pigman],Please bring the original link to reprint, thank you.
https://en.qdmana.com/2022/04/202204291628045410.html
The sidebar is recommended
- Software design pattern -- Chapter 3 structural pattern -- sharing element pattern
- Vue uses the online form of Excel in the front end of lucky sheet to import, display and export Excel files
- Vue uses echart to draw national maps and overlay charts
- Vue + element UI: Vue user-defined instruction monitors the scrolling event of El table to scroll the scroll bar to the bottom and load new data
- Vue + element when there is no paging at the back end, the front end completes the paging of El table independently - scrolling to the bottom to load new data
- [react] react routing concept
- Lenovo z475 disassembly and repair - plate No. kl6c
- Random array into an array, requiring that the elements cannot be repeated
- The belated Toyota bz4x, even with the blessing of e-tnga architecture, is still not worth starting
- In element plus, for example, how to change the checkbox status in the list by clicking on the header and selecting all
guess what you like
Crawler reverse advanced, using ast technology to restore JavaScript obfuscated code
Help, after changing the user name, the computer is useless and can't log in
Drag the left column of Vue and keep the right width unchanged; The scroll bar appears
HTML notes
In depth analysis of headless single linked list -- dynamic diagram demonstration of C language
Share 9 development skills related to vue3
CSS box centered
Used in Vue projects Sync modifier and $emit (update: XXX)
Vue class & Style binding and computed
Vue project uses this$ forceUpdate(); Force render page
Random recommended
- HTTP becomes HTTPS, self-made certificate
- Web front-end operation - tourism enterprise marketing publicity responsive website template (HTML + CSS + JavaScript)
- Self inspection list of a [qualified] front-end Engineer
- This principle in JavaScript and six common usage scenarios
- JavaScript this priority
- Analyzing the principle of HTTPS encryption
- Difference and principle between websocket and http
- Use of elementui scroll bar component El scrollbar
- Nginx security optimization
- GAC group has become the first pilot enterprise of "yueyouhang". Blessed are the car owners in Guangdong!
- Loki HTTP API usage
- JavaScript - prototype, prototype chain
- Front end experience
- JavaScript -- Inheritance
- HTTP cache
- Filters usage of table in elementui
- A JavaScript pit encountered by a non front-end siege lion
- Grain College - image error when writing Vue with vscode
- Utility gadget - get the IP address in the HTTP request
- Could not fetch URL https://pypi.org/simple/pytest-html/: There was a problem confirming the ssl cer
- Function of host parameter in http
- Use nginx proxy node red under centos7 and realize password access
- Centos7 nginx reverse proxy TCP port
- In eclipse, an error is reported when referencing layuijs and CSS
- Front end online teacher Pink
- Learn to use PHP to insert elements at the specified position and key of the array
- Learn how to use HTML and CSS styles to overlay two pictures on another picture to achieve the effect of scanning QR code by wechat
- Learn how to use CSS to vertically center the content in Div
- Learn how to use CSS to circle numbers
- Learn to open and display PDF files in HTML web pages
- The PHP array random sorting function shuffle() randomly scrambles the order of array elements
- JQuery implements the keyboard enter search function
- 16 ArcGIS API for JavaScript 4.18 a new development method based on ES modules @ ArcGIS / core
- 17 ArcGIS API for JavaScript 4.18 draw points, lines and faces with the mouse
- 18 ArcGIS API for JavaScript 4.18 obtain the length and area after drawing line segments and surface features
- Vue environment construction -- scaffold
- Build a demo with Vue scaffold
- Using vuex in Vue projects
- Use Vue router in Vue project
- 26 [react basics-5] react hook