本文整理汇总了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;
}