Exercises
Objectives
By the end of this lesson, you should be able to:
- Deploy a real application to a real platform, end to end
- Confirm it’s actually live from outside the platform
- Add a health check endpoint a platform can use for zero-downtime deploys
⚠️ A note on verification: as throughout this module, deploying to a real platform requires real infrastructure this course’s sandboxed tooling doesn’t have access to. This is a genuinely hands-on exercise, most PaaS platforms offer a free tier well-suited to exactly this, follow every step yourself.
Exercise: A Complete, Live Deployment
a) Add a health check route to a real Express app:
app.get('/health', (req, res) => {
res.json({ status: 'ok', uptime: process.uptime() });
});
process.uptime() reports how long, in seconds, the current process has been running, a small but genuinely useful signal, a health check returning 200 with a suspiciously low uptime right after a deploy is worth noticing.
b) Create an account on a PaaS platform, and connect a real GitHub repository containing this app, with its Dockerfile from Module 3.
c) Set required environment variables on the platform, JWT_SECRET, DATABASE_URL, following Module 1’s validation pattern, confirm the deployment fails to start (and says exactly why, if validateEnv() from Module 1 is wired in) if one is missing.
d) Deploy, and get a live URL.
e) Confirm it’s live, from your own machine, not the platform’s dashboard:
curl https://your-app-url.example.com/health
{"status":"ok","uptime":12.4}
A real response, from a real deployment, reachable over the real internet.
f) Trigger a second deploy, push any small change, and, if the platform’s dashboard shows it, watch the deploy happen without the /health endpoint ever returning an error in between, this is the zero-downtime property from the last lesson, working end to end.
g) Reflect. Explain, in one or two sentences, what specifically confirmed to you that the deployment was genuinely live, versus just “the dashboard says deployed.”
Recap
This module took a containerized, CI/CD-pipelined application (Modules 3 and 4) and put it on the real internet: choosing a hosting category suited to a small API, connecting a repository for automatic deploys, provisioning a managed database, configuring real production secrets the same validated way Module 1 does locally, and confirming, with a real request from outside the platform, that the deployment is genuinely live.
Next module: reverse proxies and HTTPS, what actually sits in front of that live deployment, handling encrypted connections before they ever reach application code.