3.0.1 • Published 6 years ago
nest-consul v3.0.1
Description
A component of nestcloud. NestCloud is a nest framework micro-service solution.
This is a Consul module for Nest, based on node-consul.
Installation
$ npm i --save nest-consul consul
Quick Start
Import Module
import { Module } from '@nestjs/common';
import { ConsulModule } from 'nest-consul';
@Module({
imports: [ConsulModule.register({
host: '127.0.0.1',
port: 8500
})],
})
export class ApplicationModule {}
If you use nest-boot module.
import { Module } from '@nestjs/common';
import { ConsulModule } from 'nest-consul';
import { BootModule } from 'nest-boot';
import { NEST_BOOT } from 'nest-boot';
@Module({
imports: [
BootModule.register(__dirname, 'bootstrap.yml'),
ConsulModule.register({dependencies: [NEST_BOOT]})
],
})
export class ApplicationModule {}
Nest-boot config file
consul:
host: localhost
port: 8500
Usage
import { Component } from '@nestjs/common';
import * as Consul from 'consul';
import { InjectConsul } from 'nest-consul';
@Component()
export class TestService {
constructor(@InjectConsul() private readonly consul: Consul) {}
}
API
class ConsulModule
static register(options: Options): DynamicModule
Import nest consul module.
field | type | description |
---|---|---|
options.dependencies | string[] | if you are using nest-boot module, please set NEST_BOOT |
其他 | any | see node-consul |
class Consul
see node-consul
Stay in touch
- Author - NestCloud
License
NestCloud is MIT licensed.
3.0.1
6 years ago
3.0.0
6 years ago
2.5.2
6 years ago
2.5.1
6 years ago
2.5.0
6 years ago
2.4.0
6 years ago
2.3.0
6 years ago
2.2.0
6 years ago
2.0.1
6 years ago
2.0.0
6 years ago
1.1.0
6 years ago
1.0.0
7 years ago
0.1.0
7 years ago
0.0.6
7 years ago
0.0.5
7 years ago
0.0.4
7 years ago
0.0.3
7 years ago
0.0.2
7 years ago
0.0.1
7 years ago