3.0.1 • Published 6 years ago

nest-consul v3.0.1

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

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.

fieldtypedescription
options.dependenciesstring[]if you are using nest-boot module, please set NEST_BOOT
其他anysee node-consul

class Consul

see node-consul

Stay in touch

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