1. Nodejs server setup
nodejs writes a server that others can access;
http protocol: a specification that browsers and servers abide by;
The communication between the http server and the browser is realized through http
Our server, the most important part, is monitoring, that is to say, if http sends a request to the server, then the server should receive such a request, which is monitoring;
Step 1: We create the server.js file as follows:
// 1. 导入http模块const http = require("http"); // 2. 创建一个web服务器对象const server = http.createServer(); // 3. 监听请求事件server.on("request", (req,
…
The post Building a Simple Server Using Nodejs first appeared on Lenix Blog .
This article is reprinted from https://blog.p2hp.com/archives/9121
This site is for inclusion only, and the copyright belongs to the original author.