Skip to main content

Class: ApplicationRegistry

The Registry class, this allows the Jova Server to register, use and manage its content.

Registry

Constructors

new ApplicationRegistry()

new ApplicationRegistry(options): ApplicationRegistry

Creates Registry a instance.

Parameters

options

options.basePath?: string

Returns

ApplicationRegistry

Defined in

Registry.ts:27

Methods

flush()

flush(): void

Clear all registries.

Returns

void

Defined in

Registry.ts:158


getEvents()

getEvents(): object[]

Gets all the routes currently attached to the registry.

Returns

object[]

Defined in

Registry.ts:118


getMiddlewares()

getMiddlewares(): object[]

Gets all the middlewares currently attached to the registry.

Returns

object[]

Defined in

Registry.ts:137


getRoutes()

getRoutes(): object[]

Gets all the routes currently attached to the registry.

Returns

object[]

Defined in

Registry.ts:96


registerApplicationEvent()

registerApplicationEvent(configureEvent): ApplicationListener

Register an app event to the registry, does not work if the Jova App has already been initialised, but will work if the app has not.

Parameters

configureEvent

Returns

ApplicationListener

Example

return registry.registerApplicationEvent((event) =>
event //
.setEventType(ApplicationEvent.READY)
.setHandler(this.run)
);

Defined in

Registry.ts:62


registerApplicationMiddleware()

registerApplicationMiddleware(configureMiddleware): ApplicationMiddleware

Register an app middleware to the registry, does not work if the Jova App has already been initialised, but will work if the app has not.

Parameters

configureMiddleware

Returns

ApplicationMiddleware

Example

return registry.registerApplicationMiddleware((middleware) =>
middleware //
.setMiddlewareName('middleware')
.setHandler(this.run)
.runOnAllRoutes(false)
);

Defined in

Registry.ts:83


registerApplicationRoutes()

registerApplicationRoutes(configureRoute): ApplicationRoute

Register an app route to the registry, does not work if the Jova App has already been initialised, but will work if the app has not.

Parameters

configureRoute

Returns

ApplicationRoute

Example

return registry.registerApplicationRoutes((route) =>
route //
.setRouteName('')
.setMethod(Methods.GET)
.setHandler(this.run)
);

Defined in

Registry.ts:44