How can I access Heroku's assigned port with sirv?
Create an .env
file (add to .gitignore
) with contents:
HOST=localhostPORT=5000
package.json
start command:
{ "start": "sirv public --host $HOST --port $PORT"}
When running locally for development execute:
heroku local
This will pickup your env vars from .env
In production, Heroku will provide $HOST
and $PORT
$HOST
can probably be replaced with hard-coded 0.0.0.0
if desired: