← Back to Community
Why is the IDE preview blank?
Profile icon
Socked

I am making a NodeJS Express app and the preview in the IDE is blank even though I can see it in my browser.

The problem only happens if I use helmet.

Answered by xfinnbar [earned 5 cycles]
View Answer
Voters
Profile icon
Socked
Comments
hotnewtop
Profile icon
xfinnbar

You need to listen on 0.0.0.0 instead of localhost.

Profile icon
Socked

@xfinnbar I found the solution myself, but how do I do that on replit? Just curious.

Solution:

// use helmet({ frameguard:false }); // instead of just helmet();
Profile icon
xfinnbar

Not a Node guy myself, but in Python Flask you use app.run("0.0.0.0") @Socked

Profile icon
Socked

Ohh, I’ve never used Python at all. In Node I just do

app.listen(3000,()=>{console.log(`I’M AWAKE`)})

@xfinnbar

Profile icon
xfinnbar

Node must listen on 0.0.0.0 by default. In Python and a lot of other languages, localhost is default. @Socked