A Node.js Express application ready to deploy on Convox.
This example demonstrates how to deploy a Node.js application with Express on Convox. The app includes health checks, environment variable usage, and RESTful API endpoints - showing best practices for Node.js services in production.
Deploy to Convox Cloud for a fully-managed platform experience, or to your own Convox Rack for complete control over your infrastructure. Either way, you'll get automatic SSL, load balancing, and zero-downtime deployments out of the box.
-
Create a Cloud Machine at console.convox.com
-
Create the app:
convox cloud apps create nodejs -i your-machine-name- Deploy the app:
convox cloud deploy -a nodejs -i your-machine-name- View your app:
convox cloud services -a nodejs -i your-machine-nameVisit your URL to see the JSON response!
- Create the app:
convox apps create nodejs- Deploy the app:
convox deploy -a nodejs- View your app:
convox services -a nodejsVisit your URL to see the JSON response!
GET /- Main endpoint with environment infoGET /health- Health check endpointGET /api/info- Application informationPOST /api/echo- Echo back JSON data
# Get main endpoint
curl https://your-app-url/
# Check health
curl https://your-app-url/health
# Get app info
curl https://your-app-url/api/info
# Test POST endpoint
curl -X POST https://your-app-url/api/echo \
-H "Content-Type: application/json" \
-d '{"message": "Hello Convox!"}'npm install
PORT=3000 npm startVisit http://localhost:3000 to see your app running locally.
convox cloud scale web --count 2 --cpu 500 --memory 1024 -a nodejs -i your-machine-nameconvox scale web --count 2 --cpu 500 --memory 1024 -a nodejsSet custom environment variables:
convox cloud env set API_KEY=secret NODE_ENV=production -a nodejs -i your-machine-nameconvox env set API_KEY=secret NODE_ENV=production -a nodejs- Node.js 20 with Express framework
- Health check endpoints for monitoring
- Environment-based configuration
- Non-root container for security
- Optimized Docker layer caching
Cloud:
convox cloud logs -a nodejs -i your-machine-nameRack:
convox logs -a nodejsCloud:
convox cloud run web "node --version" -a nodejs -i your-machine-nameRack:
convox run web "node --version" -a nodejsCloud:
convox cloud exec web sh -a nodejs -i your-machine-nameRack:
convox run exec web sh -a nodejs