Sapper: Can i change host?

Created on 19 Oct 2018  路  6Comments  路  Source: sveltejs/sapper

@Rich-Harris , Can i change host? By default is localhost, i want use 0.0.0.0

Most helpful comment

Would be cool if Sapper could log to the console the link through which the dev server can be viewed on other devices. Right now, sapper dev only gives

> Listening on http://localhost:3000

whereas pure Svelte using rollup -c -w prints

Your application is ready~! 馃殌

- Local:      http://0.0.0.0:5000
- Network:    http://10.248.97.251:5000

All 6 comments

The default is already to listen on all interfaces (:: for IPv6 and 0.0.0.0 for IPv4). The host that Sapper listens on is controlled in your application code. If you're based on the default templates, that would be here. No host argument is passed to .listen(), so the server does not bind to a particular interface.

@Conduitry, thanks for answer!

@khaninD Are you able to post your solution? I've tried making changes to server.js to allow setting the host to 0.0.0.0 and haven't been successful thus far.

Are you able to post your solution? I've tried making changes to server.js to allow setting the host to 0.0.0.0 and haven't been successful thus far.

Thanks for the reply @bato3 - I feel ridiculous. I was trying to open my app on another machine to aid development from npm run dev and the only thing needing changed was not server.js but rather identifying my home network as private and not public in network settings.

Would be cool if Sapper could log to the console the link through which the dev server can be viewed on other devices. Right now, sapper dev only gives

> Listening on http://localhost:3000

whereas pure Svelte using rollup -c -w prints

Your application is ready~! 馃殌

- Local:      http://0.0.0.0:5000
- Network:    http://10.248.97.251:5000
Was this page helpful?
0 / 5 - 0 ratings

Related issues

Snugug picture Snugug  路  4Comments

Rich-Harris picture Rich-Harris  路  4Comments

UnwrittenFun picture UnwrittenFun  路  4Comments

Rich-Harris picture Rich-Harris  路  4Comments

SARFEX picture SARFEX  路  3Comments