Skip to main content

Class: BaseAdminRoute

Defined in: service-core/src/routes/BaseAdminRoute.ts:78

The BaseAdminRoute class provides a base set of endpoints that gives trusted users the ability to perform common adminstrative actions with the server. Note that this route class requires elevated user privileges to perform any action.

Exposed endpoints:

NameHTTP MethodWhat it does
clearCacheGET /<base_path>/clear-cacheClears the Redis-based cache system.
logsUPGRADE /<base_path>/logsLive tail the service logs
getReleaseNotesGET /<base_path>/release-notesRetrieve the server release notes.
restartGET /<base_path>/restart` Restart the server

!!Note!! that the BaseAdminRoute is not automatically registered with a server by default. You must create your own class that extends AdminRoute and apply the desired base path with @Route().

Example​

import \{ BaseAdminRoute, RouteDecorators \} from "@rapidrest/service-core";
const \{ Route \} = RouteDecorators;

@Route("/admin")
export class AdminRoute extends BaseAdminRoute \{\}

Constructors​

Constructor​

new BaseAdminRoute(): BaseAdminRoute

Returns​

BaseAdminRoute

Properties​

activeSockets​

protected activeSockets: Map<string, any[]>

Defined in: service-core/src/routes/BaseAdminRoute.ts:80

A map of user uid's to active sockets.


cacheClient?​

protected optional cacheClient?: RedisClientType

Defined in: service-core/src/routes/BaseAdminRoute.ts:83


cacheConnConfig​

protected cacheConnConfig: any

Defined in: service-core/src/routes/BaseAdminRoute.ts:86


logger​

protected logger: any

Defined in: service-core/src/routes/BaseAdminRoute.ts:89


logsConnConfig​

protected logsConnConfig: any

Defined in: service-core/src/routes/BaseAdminRoute.ts:92


redisClient?​

protected optional redisClient?: RedisClientType

Defined in: service-core/src/routes/BaseAdminRoute.ts:94


redisPublisher?​

protected optional redisPublisher?: RedisClientType

Defined in: service-core/src/routes/BaseAdminRoute.ts:101

A dedicated connection for publishing admin channel messages (e.g. the RESTART signal). redisClient issues SUBSCRIBE in init(), which puts it into subscriber-only mode — Redis connections in that state can't also run PUBLISH, so a separate connection is required.


releaseNotes?​

protected optional releaseNotes?: string

Defined in: service-core/src/routes/BaseAdminRoute.ts:104

The underlying ReleaseNotes specification.


serviceName?​

protected optional serviceName?: string

Defined in: service-core/src/routes/BaseAdminRoute.ts:107


trustedRoles​

protected trustedRoles: string[] = []

Defined in: service-core/src/routes/BaseAdminRoute.ts:110

Methods​

clearCache()​

clearCache(user?): Promise<void>

Defined in: service-core/src/routes/BaseAdminRoute.ts:159

Parameters​

user?​

JWTUser

Returns​

Promise<void>


getReleaseNotes()​

getReleaseNotes(user?): string | undefined

Defined in: service-core/src/routes/BaseAdminRoute.ts:259

Parameters​

user?​

JWTUser

Returns​

string | undefined


init()​

protected init(): Promise<void>

Defined in: service-core/src/routes/BaseAdminRoute.ts:113

Returns​

Promise<void>


logs()​

logs(socket, user): Promise<void>

Defined in: service-core/src/routes/BaseAdminRoute.ts:180

Parameters​

socket​

IWebSocketShim

user​

JWTUser

Returns​

Promise<void>


restart()​

restart(user?): void

Defined in: service-core/src/routes/BaseAdminRoute.ts:273

Parameters​

user?​

JWTUser

Returns​

void