express-server

Builds a TypeScript Express server with InversifyJS, Socket.IO, and Supertest.

11|2|Updated Feb 5, 2026
One-click install
npx skills add https://github.com/recca0120/code-quest --skill express-server
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: express-server
Source: https://github.com/recca0120/code-quest/tree/main/.claude/skills/express-server
Command: npx skills add https://github.com/recca0120/code-quest --skill express-server

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It solves the need for a consistent, production-grade Express server setup that correctly handles security, middleware ordering, async errors, health checks, shutdown behavior, dependency injection, and testability.

Core Features & Use Cases

  • Thin HTTP layer with DI: Keep route files minimal by resolving services from an InversifyJS container rather than instantiating logic directly in handlers.
  • Correct middleware ordering: Apply helmet first, configure CORS early, parse JSON with limits, add rate limiting, serve static content safely, expose a no-auth health endpoint, mount API routes, and attach error handling last.
  • Reliable async error handling in Express 4: Prevent silent hangs by using an async handler wrapper or express-async-errors, and ensure the error middleware signature uses four parameters.
  • Security hardening: Use helmet plus safe CORS configuration (avoid wildcard origins when using credentials).
  • Operational readiness: Add a Kubernetes-friendly health route and implement graceful shutdown, including proper Socket.IO closure.
  • Test with Supertest: Validate endpoints without port conflicts by building the app from a test container and running requests directly against the Express instance.

Quick Start

Ask the skill to generate an Express server template that uses a DI container, sets the middleware in the required order, adds robust async error handling, and supports Supertest-based endpoint tests.

Frequently Asked Questions about express-server

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I structure an Express server with TypeScript and InversifyJS dependency injection?

Structure your Express server by using an app factory that resolves services from an InversifyJS container, keeping route handlers thin. This setup ensures testable, production-ready HTTP APIs without coupling business logic to route definitions.

What is the correct middleware ordering for a production Express API?

Correct middleware ordering requires applying helmet first, configuring CORS early, parsing JSON with limits, adding rate limiting, serving static content, exposing health endpoints, mounting routes, and attaching the four-parameter error handler last.

How do I handle async errors in Express 4 to prevent silent hangs?

Handle async errors in Express 4 by using an async handler wrapper or express-async-errors, and ensure the error middleware signature uses four parameters to catch rejected promises and prevent silent request hangs.

Can I test Express endpoints with Supertest without port conflicts?

Test Express endpoints with Supertest by building the app from a real or stub InversifyJS container and running requests directly against the Express instance, avoiding port conflicts and ensuring isolated endpoint validation.

How do you implement graceful shutdown for an Express and Socket.IO server?

Implement graceful shutdown by closing the Express server and executing proper Socket.IO shutdown sequencing, ensuring active connections drain correctly before the process exits to maintain operational readiness.

Why should I avoid wildcard CORS origins when using credentials in Express?

Avoid wildcard CORS origins when using credentials to ensure security hardening. Configuring specific origins with helmet and safe CORS prevents unauthorized cross-origin requests from accessing authenticated resources.