Roadmap › Node.js — Runtime Internals, Express, APIs and SQL Server › Module: Performance and Production
Lessons in this course (11)
11. Testing, logging and deploying Node.js apps
IntermediateMediumLesson 11 of 11
js
// tests/products.test.js — node:test + supertest
import { test } from 'node:test';
import assert from 'node:assert/strict';
import request from 'supertest';
import { app } from '../src/app.js';
test('GET /api/products returns a list', async () => {
const res = await request(app).get('/api/products').expect(200);
assert.ok(Array.isArray(res.body.items));
});dockerfile
FROM node:22-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci --omit=dev
COPY src ./src
USER node
ENV NODE_ENV=production
EXPOSE 3000
CMD ["node", "src/server.js"]Deploy targets: Docker on any cloud, Azure App Service (Linux, Node runtime), AWS Elastic Beanstalk/ECS/Lambda, Vercel/Netlify functions, or IIS with iisnode / reverse proxy (IIS + URL Rewrite → Node on a port) on Windows servers. Logging: pino (fast JSON) or winston; set NODE_ENV=production (Express caches views and reduces error detail).