0.0.3 • Published 6 years ago
nest-bootstrap v0.0.3
Description
This is a Consul module for Nest.
Installation
$ npm i --save nest-bootstrap
Quick Start
Import Module
import { Module } from '@nestjs/common';
import { BootstrapModule } from 'nest-bootstrap';
@Module({
imports: [BootstrapModule.forRoot(__dirname, env => `bootstrap-${env}.yml`)],
})
export class ApplicationModule {}
Config File
web:
port: 3000
Consul Client Injection
import { Component } from '@nestjs/common';
import { InjectBootstrap, Bootstrap } from 'nest-bootstrap';
@Component()
export class TestService {
constructor(@InjectBootstrap() private readonly bootstrap: Bootstrap) {}
getPort() {
return this.bootstrap.get('web.port', 3000);
}
}
Support
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please read more here.
Stay in touch
- Author - Miaowing
- Website - https://nestjs.com
License
Nest is MIT licensed.