Bind your app to 0.0.0.0 and the right port
Your app must listen on 0.0.0.0 and the port allocated to your Schokr server. Here is how to do that in Node.js, Bun and Python.
Updated · 2 min read
To be reachable on Schokr, your app must listen on host 0.0.0.0 (all interfaces) and on the port shown in your server's Network section. Listening on localhost, 127.0.0.1 or a hard-coded port like 3000 that is not allocated to you means nobody can connect.
Why this matters
localhostand127.0.0.1only accept connections from inside the server itself. Traffic from the internet never reaches them.- Only the ports allocated to your server are forwarded to it. Each server starts with one allocation. If your app listens on any other port, requests time out or are refused.
Find your port
Open your server's Network section in the console. You will see the address and port of your allocation, for example <server-address>:25571. That number is the port your app must use.
Make the port configurable
Hard-coding works, but it is better to read the port from an environment variable you control, with a fallback for local development. Set the variable in your server's Startup settings if the template exposes one for you, or in a .env file your app loads (see environment variables and secrets). The variable name is up to you; APP_PORT is used below.
Node.js (Express)
const express = require('express')
const app = express()
const port = Number(process.env.APP_PORT || 3000)
app.get('/', (req, res) => res.send('ok'))
app.listen(port, '0.0.0.0', () => console.log(`Listening on ${port}`))
Bun
Bun.serve({
hostname: '0.0.0.0',
port: Number(process.env.APP_PORT || 3000),
fetch: () => new Response('ok'),
})
Python (Flask with gunicorn)
gunicorn --bind 0.0.0.0:25571 app:app
Python (FastAPI with uvicorn)
uvicorn main:app --host 0.0.0.0 --port 25571
Replace 25571 with your own allocated port.
Frameworks with their own defaults
| Tool | Default host | How to change |
|---|---|---|
| Flask dev server | 127.0.0.1:5000 | app.run(host="0.0.0.0", port=...) |
| uvicorn | 127.0.0.1:8000 | --host 0.0.0.0 --port ... |
| Django runserver | 127.0.0.1:8000 | runserver 0.0.0.0:PORT (dev only) |
Next.js next start | all interfaces, 3000 | next start -H 0.0.0.0 -p PORT |
| Vite preview | localhost, 4173 | vite preview --host 0.0.0.0 --port PORT |
Check it works
Start the server and look for your "listening" log line in the console, then open http://<server-address>:<port>. If it still does not load, see app not reachable in the browser.
Still stuck?
Post your startup log and the port from the Network section in the Schokr Discord.