OGeek|极客世界-中国程序员成长平台

标题: node.js - Bind expressjs to a specific IP address [打印本页]

作者: 菜鸟教程小白    时间: 2022-5-24 14:16
标题: node.js - Bind expressjs to a specific IP address

How can i bind a expressjs server to a specific IP

Something like

app.listen(8888, '192.168.0.101');

Equivalent to nodejs:

http.createServer(onRequest).listen(8888,'192.168.0.101');


Best Answer-推荐答案


ExpressJS just passes your parameters down to the http module when you call listen, so your example should work.

Is that not the case?






欢迎光临 OGeek|极客世界-中国程序员成长平台 (https://ogeek.cn/) Powered by Discuz! X3.4