← Node.js & Express learning path
Node.js & Express · Module 10 of 10

Testing and deploying Node apps

Test your API, then run it reliably in production.

📖 Key ideas

  1. Unit test with Jest or Vitest; API test with Supertest.
  2. Use nodemon in development, not production.
  3. Process managers (PM2) or containers (Docker) keep apps running.
  4. Deploy to Render, Railway, AWS, Google Cloud Run or a VPS.
  5. Log errors and monitor health with a /health endpoint.
💡 Real-life example: PM2 is a night guard: if the app falls asleep (crashes), it wakes it up again.
SupertestTests HTTP endpoints
PM2Node process manager
Health checkEndpoint showing the app is alive
NODE_ENVSets development or production mode