express app server . listen all interfaces instead of localhost only

前端 未结 3 870
时光取名叫无心
时光取名叫无心 2020-12-14 05:47

I\'m very new for this stuff, and trying to make some express app

var express = require(\'express\');
var app = express();

app.listen(3000, function(err) {
         


        
3条回答
  •  北荒
    北荒 (楼主)
    2020-12-14 06:16

    From the documentation: app.listen(port, [hostname], [backlog], [callback])

    Binds and listens for connections on the specified host and port. This method is identical to Node’s http.Server.listen().

    var express = require('express');
    var app = express();
    app.listen(3000, '0.0.0.0');
    

提交回复
热议问题