Deploy a Node.js service with a health check and persistent data
Build your app for Node.js 24 and include its runtime dependencies. Set the start file and a health-check path, and listen on 0.0.0.0 and the port assigned through process.env.PORT. Deplark keeps the previous release available if startup fails.
Run the example locally
Extract the ZIP into a separate folder and run the commands from there. The example needs only Node.js and curl.
node --version
PORT=3000 DATA_DIR=./data node server.mjs
In another terminal, check the service and update its test counter.
curl -fsS http://127.0.0.1:3000/health
curl -fsS -X POST http://127.0.0.1:3000/api/counter
curl -fsS http://127.0.0.1:3000/api/counter
Publish and verify the service
- Create a Node.js project, upload the example, set
server.mjsas the entry and/healthas the health check. - When it is ready, open
/healthon the project’s HTTPS address. Confirm HTTP 200 and{"status":"ok"}. - On the disposable example, update and read
/api/counter. Redeploy the same example and check the counter again. Write app data toDATA_DIRso it persists independently of code releases.
Trial and visitor access
Free accounts can activate a limited 14-day Node.js trial. Review the current plan before hosting production traffic. For mainland visitors, check the API from the same networks as your users. Guangzhou hosting applies to public media. See the visitor-network checklist for the page and API checks.