Skip to content

covenix / ControllerGroup

Class: ControllerGroup

Defined in: src/covenix.ts:125

A registration scope created by Covenix.group: registers controllers under a shared base path (e.g. a /v1 version segment). Groups nest — a nested ControllerGroup.group appends its prefix to the enclosing one.

Example

ts
api.group('/v1', (v1) => {
  v1.register(new UsersController(svc));
  v1.register(new AuthController(auth));
});

Constructors

Constructor

new ControllerGroup(add, basePrefix): ControllerGroup

Defined in: src/covenix.ts:127

Internal

— constructed by Covenix.group.

Parameters

add

(instance, prefix) => void

basePrefix

string

Returns

ControllerGroup

Methods

group()

group(prefix, fn): this

Defined in: src/covenix.ts:148

Opens a nested group whose prefix is appended to this group's.

Parameters

prefix

string

fn

(group) => void

Returns

this

This group, for chaining.


register()

register(instance, options?): this

Defined in: src/covenix.ts:138

Registers a controller under this group's base path. An optional prefix is appended to the group's.

Parameters

instance

object

options?

RegisterOptions = {}

Returns

this

This group, for chaining.