// FOR CASE SUCCESS
import { HTTP_CONFIG } from 'kf-sdk';
@get('/', {
responses: {
'200': OBJECT_EXAMPLE,
},
})
async version(): Promise<Object> {
return this.responseSuccess(
HTTP_CONFIG.OK.code,
{
ip: this.req.ip,
name: this.servicename
}
)
}
// FOR CASE ERROR
import { HTTP_CONFIG } from 'kf-sdk';
@get('/', {
responses: {
'200': OBJECT_EXAMPLE,
},
})
async version(): Promise<Object> {
return this.responseSuccess(
HTTP_CONFIG.errorPasswordInvalid.code,
{
ip: this.req.ip,
name: this.servicename
}
)
}
export class VersionController extends KFController {
constructor(
@inject(RestBindings.Http.REQUEST) private req: Request,
@inject(RestBindings.Http.RESPONSE) protected response: Response,
@inject('service.name') private servicename: String
) {
super();
}
@get('/', {
responses: {
'200': PING_RESPONSE,
},
})
async version(): Promise<Object> {
return this.responseFailed(
HTTP_CONFIG.OK.code,
{
ip: this.req.ip,
name: this.servicename,
version: require('../../package.json').version,
}
)
}
}
kf-sdk
1.0.8 • Public • PublishedPackage Sidebar
Install
npm i kf-sdk
Weekly Downloads
3
Version
1.0.8
License
none
Unpacked Size
99.6 kB
Total Files
104