Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
627 views
in Technique[技术] by (71.8m points)

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');
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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

Is that not the case?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...