Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do i restrict my node express application to localhost only?

I have a node express application that I want to only be available to the localhost client. How can I prevent other hosts from accessing my node express app?

like image 383
srayner Avatar asked Nov 11 '14 12:11

srayner


1 Answers

When you start listening your server just mentioned the host name as 'localhost'. Take a look at the following code.

var app = require('express')();
app.listen(8000,'localhost');
like image 100
Asis Datta Avatar answered Oct 14 '22 10:10

Asis Datta