Skip to main content
Scaffolds a middleware class and its test file into the target module, then registers the class in the middlewares array of the module. It writes modules/<module>/src/middlewares/<Name>Middleware.ts and modules/<module>/tests/middlewares/<Name>Middleware.spec.ts, and installs the @ooneex/middleware dependency if it is missing. Pass --is-socket to generate a WebSocket middleware instead of an HTTP one; if omitted, you are asked interactively.

Usage

ooneex middleware:create [options]

Examples

ooneex middleware:create
ooneex middleware:create --name=Auth --is-socket=false
ooneex middleware:create --name=RateLimit --module=api --is-socket=true

Options

OptionDescriptionDefault
--nameResource name (the Middleware suffix is appended automatically).Prompted if omitted
--moduleTarget module.shared
--is-socketGenerate a socket middleware instead of an HTTP one.Prompted if omitted
--overrideOverwrite an existing file without confirmation.false

AI Skill

This command ships a matching middleware:create skill. Your AI agent uses it to generate a new HTTP or WebSocket middleware class and its test file, then implement the handler logic for the IMiddleware interface from @ooneex/middleware.
ooneex claude:init