hapi
Installation
SKILL.md
Hapi
Quick Start
const server = Hapi.server({ port: 3000 });
server.route({ method: 'GET', path: '/', handler: () => 'ok' });
await server.start();
Critical Rules
- Compose with decorations & methods - Expose services via decorations and reusable logic via methods
- Follow the lifecycle - 24-step request flow; see lifecycle overview
- Auth is three layers - scheme → strategy → default; see server auth
- Validate at the route - Use joi schemas on params, query, payload, headers; see validation
- Type routes with Refs - Use
ServerRoute<Refs>with ONLY the keys you need (Params, Query, Payload, etc.); omitted keys keep defaults. See route scaffold
Auth three-layer pattern: