How to deploy a Node API (high level) — Intermediate
Push to GitHub, connect host (e.g. Render), set env vars, run migrations, confirm health endpoint and CORS for the frontend origin.
Learn: Deployment connects Git, hosting, database, and frontend CORS. The same repo runs locally with .env and in production with host-managed secrets—never commit real credentials.
Supplementary examples
Production env on Render (typical)
NODE_ENV=production
DATABASE_URL=<render-postgres-url>
PORT=10000
FRONTEND_URL=https://your-app.onrender.comCourse example
# Deployment checklist
# 1. .env values set on host (DATABASE_URL, PORT, NODE_ENV=production)
# 2. Build command: npm install
# 3. Start command: npm start
# 4. Run knex migrate:latest against production DB
# 5. Smoke test: GET /health or GET /
Additional references & examples
- Render — deploy a web service
Hosting Node/Express APIs (referenced in deployment lessons).
- Render environment variables
Configure secrets and PORT on the host.