I would like to ask what core statement has been added to Express to listen to the public network port?

I bought an Aliyun ecs host, but why can"t I use the original node to listen to a port that cannot be accessed through the public network, but can access it through the public network with express monitoring? what core sentences does express have to solve this problem?

NODE native:

var http = require("http");
var server = http.createServer(function(req,res){
    res.writeHead(200,{"Content-type":"text/html;charset=UTF-8"});
    res.end("ok");
});
server.listen(3000);

Express:

var express = require("express");
var app = express();
app.get("/",function(req,res){
    res.writeHead(200,{"Content-type":"text/html;charset=UTF-8"});
    res.end("ok");
});
app.listen(3000);

the above statement is also listening to port 3000.
access to port 3000 via public network ip:3000 is enabled after Aliyun"s backend security settings are enabled. Express can get data, but node can"t write it itself.


take a look at netstat-plnt , is Local Adress 0.0.0.0 answer 3000 when running with node natively?


I'm sorry I really made a mistake. The bottom layer of express does call server.listen through the http module. Previously, it was written as server.listen (3000, "127.0.0.1"); this can only be called locally and can not be accessed on the public network. I did make a mistake. I'm sorry. The ip address is not written in the above two codes. All of them can be accessed normally

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b377e8-2c0a5.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b377e8-2c0a5.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?