Deploy Express

Any Node.js app with a package.json containing a start script deploys out of the box.

Detection

Leash detects Node.js apps by looking for a package.json with a start script in the scripts field.

Example App

index.js
const express = require('express')
const app = express()
const port = process.env.PORT || 8080
app.use(express.json())
app.get('/', (req, res) => {
res.json({ message: 'Hello from Leash!' })
})
app.get('/api/health', (req, res) => {
res.json({ status: 'ok', uptime: process.uptime() })
})
app.listen(port, () => {
console.log(`Server running on port ${port}`)
})

package.json

package.json
{
"name": "my-express-app",
"version": "1.0.0",
"scripts": {
"start": "node index.js"
},
"dependencies": {
"express": "^4.18.0"
}
}

Deploy

Terminal

$ cd my-express-app

$ leash deploy

✓ Detected Node.js

✓ Image built and pushed

✓ Deployed successfully!

→ https://my-express-app-your-org.un.leash.build

Required: listen on process.env.PORT

Cloud Run injects the PORT environment variable (always 8080) at runtime. Your app must read it. If you hardcode a port, Cloud Run will fail the startup probe and the URL will return HTTP 503 forever — the dashboard will still show the deployment as “active”.