Z
Zerops3mo ago
Jan Brus

How can i access my nodejs backend api from outside?

My backend seems to be deployed, but I can't find correct url that i can use. I own a domain that is currently aimed elsewhere (on render.com). I wanted to test the deployed backend before switching up domains. Is the node.js available on some public url? Where can I find it?
5 Replies
Aleš
Aleš3mo ago
Go to service detail, click on "Subdomain & domain & IP access"
No description
No description
Aleš
Aleš3mo ago
enable subdomain, domain or direct access with IP address this requires port to be exposed with httpSupport set to true (if you want to use subdomain / domain), e.g. https://github.com/zeropsio/recipe-nodejs/blob/main/zerops.yml#L16-L18
Jan Saidl
Jan Saidl3mo ago
BTW if you only want to deploy the contents of the backend directory, use backend/~, then cd is not needed. Your application is not currently running. That's why there is http code 502 on the zerops subdomain.
zerops:
setup: nodejs
build:
os: alpine
base: nodejs@22
buildCommands:
- ls -la
- cd backend && npm i
deployFiles:
- backend/~
cache:
- backend/node_modules
- backend/package-lock.json
run:
os: alpine
base: nodejs@22
start: node src/app.js
ports:
- port: 3000
httpSupport: true
zerops:
setup: nodejs
build:
os: alpine
base: nodejs@22
buildCommands:
- ls -la
- cd backend && npm i
deployFiles:
- backend/~
cache:
- backend/node_modules
- backend/package-lock.json
run:
os: alpine
base: nodejs@22
start: node src/app.js
ports:
- port: 3000
httpSupport: true
https://docs.zerops.io/zerops-yaml/specification#using-wildcards
Aleš
Aleš3mo ago
you can always confirm whether the app is actually running in the runtime log .. 502 on subdomain usually either means the app is not running (would show up in runtime log), or it's not properly exposed (needs to run on 0.0.0.0 host and on the same port you've defined in zerops.yml)
No description
Jan Brus
Jan BrusOP3mo ago
found the url, thank you oh wow, you even checked my account and project. I have applied your suggested changes and the bakcend is now correctly running. Amazing support. Thank you.

Did you find this page helpful?