Ask coding questions

← Back to all posts
Why is the IDE preview blank?
Socked (0)

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 (134) [earned 5 cycles]
View Answer
Comments
hotnewtop
xfinnbar (134)

You need to listen on 0.0.0.0 instead of localhost.

Socked (0)

@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();
xfinnbar (134)

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

Socked (0)

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

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

@xfinnbar

xfinnbar (134)

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