Skip to main content

Class: BaseAdminRoute

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

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:79

A map of user uid's to active sockets.


cacheClient?

protected optional cacheClient?: RedisClientType

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


cacheConnConfig

protected cacheConnConfig: any

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


logger

protected logger: any

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


logsConnConfig

protected logsConnConfig: any

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


redisClient?

protected optional redisClient?: RedisClientType

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


redisPublisher?

protected optional redisPublisher?: RedisClientType

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

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:103

The underlying ReleaseNotes specification.


serviceName?

protected optional serviceName?: string

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


trustedRoles

protected trustedRoles: string[] = []

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

Methods

clearCache()

clearCache(user?): Promise<void>

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

Parameters

user?

JWTUser

Returns

Promise<void>


getReleaseNotes()

getReleaseNotes(user?): string | undefined

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

Parameters

user?

JWTUser

Returns

string | undefined


init()

protected init(): Promise<void>

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

Returns

Promise<void>


logs()

logs(socket, user): Promise<void>

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

Parameters

socket

IWebSocketShim

user

JWTUser

Returns

Promise<void>


restart()

restart(user?): void

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

Parameters

user?

JWTUser

Returns

void