nestjs-consul
Version:
NestJS consul config Module
29 lines (23 loc) • 603 B
text/typescript
import { Controller } from '@nestjs/common';
import { ConsulService } from '../../lib';
import { ConfigInterface, ITest } from './config.interface';
()
export class ApiController {
constructor(private readonly consul: ConsulService<ConfigInterface>) {
}
async testConfig() {
return this.consul.configs;
}
async setConfig(value: string) {
return this.consul.set<ITest>('am-cli/test', {
valueNum: 1,
valuesString: value
});
}
async getConfig() {
return this.consul.get<ITest>('am-cli/test');
}
async deleteConfig() {
return this.consul.delete('am-cli/test');
}
}