本文整理匯總了TypeScript中routing-controllers.Get函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript Get函數的具體用法?TypeScript Get怎麽用?TypeScript Get使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了Get函數的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: getStatus
@Get('/')
@OpenAPI({
summary: "Get Loader Status",
description: "Check to see if blockchain has been loaded by node"
})
@ResponseSchema('responses.loader.getStatus')
public getStatus() {
return {
loaded: this.loaderModule.loaded,
};
}
示例2: getStatusSync
@Get('/sync')
@OpenAPI({
summary: "Get Loader Sync Status",
description: "Retrieve current status of node's blockchain sync"
})
@ResponseSchema('responses.loader.getStatusSync')
public getStatusSync() {
return {
broadhash: this.systemModule.broadhash,
consensus: this.appState.get('node.consensus'),
height : this.blocksModule.lastBlock.height,
syncing : this.loaderModule.isSyncing,
};
}
示例3: ping
@Get('/ping')
@OpenAPI({
summary: "Ping",
description: "Ping node to see if capable of syncing quickly enough (within two blocks)"
})
@ResponseSchema('responses.loader.ping')
public ping() {
let status = false;
if (this.blocksModule.lastBlock) {
const secondsAgo = Math.floor(Date.now() / 1000) -
(Math.floor(this.constants.epochTime.getTime() / 1000) + this.blocksModule.lastBlock.timestamp);
status = secondsAgo < this.constants.blockReceiptTimeOut;
}
return { success: status };
}
示例4: get
@Get('/')
async get(): Promise<any> {
let client = await this.client;
let pet = await client.pet.getPetById({ petId: 7 });
return pet;
}