nest-bootstrap
TypeScript icon, indicating that this package has built-in type declarations

0.0.3 • Public • Published

Nest Logo

A progressive Node.js framework for building efficient and scalable server-side applications, heavily inspired by Angular.

NPM Version Package License NPM Downloads Travis Linux Coverage Gitter Backers on Open Collective Sponsors on Open Collective

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

License

Nest is MIT licensed.

/nest-bootstrap/

    Package Sidebar

    Install

    npm i nest-bootstrap

    Weekly Downloads

    3

    Version

    0.0.3

    License

    MIT

    Unpacked Size

    52.2 kB

    Total Files

    22

    Last publish

    Collaborators

    • zfeng