0.7.17 • Published 3 years ago

@nestcloud/common v0.7.17

Weekly downloads
494
License
MIT
Repository
github
Last release
3 years ago

NestCloud

NestCloud is a NodeJS micro-service solution, writing by Typescript language and NestJS framework. Consul, Etcd or Kubernetes all can be the service discovery center for NestCloud.

Install

You need install the packages by the service discovery that which you select.

Consul Backend

$ npm install --save @nestcloud/core
$ npm install --save @nestcloud/common
$ npm install --save @nestcloud/boot 
$ npm install --save @nestcloud/consul 
$ npm install --save @nestcloud/service 
$ npm install --save @nestcloud/config 
$ npm install --save @nestcloud/loadbalance 
$ npm install --save @nestcloud/feign 
$ npm install --save @nestcloud/logger 

Etcd Backend

$ npm install --save @nestcloud/core
$ npm install --save @nestcloud/common
$ npm install --save @nestcloud/boot 
$ npm install --save @nestcloud/etcd 
$ npm install --save @nestcloud/service 
$ npm install --save @nestcloud/config 
$ npm install --save @nestcloud/loadbalance 
$ npm install --save @nestcloud/feign 
$ npm install --save @nestcloud/logger 

Kubernetes Backend

$ npm install --save @nestcloud/core
$ npm install --save @nestcloud/common
$ npm install --save @nestcloud/boot 
$ npm install --save @nestcloud/config 
$ npm install --save @nestcloud/loadbalance 
$ npm install --save @nestcloud/feign 
$ npm install --save @nestcloud/logger 
$ npm install --save @nestcloud/kubernetes 

Docs

中文文档

Examples

nestcloud-typeorm-example

nestcloud-grpc-example

nestcloud-kubernetes-example

Starter

nestcloud-consul-starter

nestcloud-etcd-starter

Components

Consul

Consul module.

Etcd

Etcd module.

Memcached

Memcached module.

Kubernetes

Kubernetes client module.

Boot

Get local configurations.

Config

Get & watch remote configurations from Consul KV or Kubernetes ConfigMap.

Service

Service registration and service discovery

Loadbalance

Software load balancers primary for rest calls.

Feign

A decorator and loadbalance http client.

Grpc

A loadbalance grpc client.

Proxy

A API proxy module.

Schedule

A job scheduler that supports distributed and decorator.

Logger

Logger module based on winston@2.x

Validations

Validate request params.

Rbac

Role based access control.

Quick Start

main.ts

import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
import { NestLogger } from '@nestcloud/logger';
import { NestCloud } from '@nestcloud/core';

async function bootstrap() {
    const app = NestCloud.create(await NestFactory.create(AppModule, {
        logger: new NestLogger({
            path: __dirname,
            filename: `config.yaml`
        }),
    }));

    await app.listen(NestCloud.global.boot.get('consul.service.port', 3000));
}

bootstrap();

app.module.ts

import { Module } from '@nestjs/common';
import { NEST_BOOT, NEST_LOADBALANCE, NEST_CONSUL } from '@nestcloud/common';
import { BootModule } from '@nestcloud/boot';
import { ConsulModule } from '@nestcloud/consul';
import { ConfigModule } from '@nestcloud/config';
import { ServiceModule } from '@nestcloud/service';
import { LoadbalanceModule } from '@nestcloud/loadbalance';
import { FeignModule } from '@nestcloud/feign';
import { LoggerModule } from '@nestcloud/logger';
import { TerminusModule } from '@nestjs/terminus';

@Module({
    imports: [
        LoggerModule.register(),
        BootModule.register(__dirname, `config.yaml`),
        ConsulModule.register({ dependencies: [NEST_BOOT] }),
        ConfigModule.register({ dependencies: [NEST_BOOT, NEST_CONSUL] }),
        ServiceModule.register({ dependencies: [NEST_BOOT, NEST_CONSUL] }),
        LoadbalanceModule.register({ dependencies: [NEST_BOOT] }),
        FeignModule.register({ dependencies: [NEST_BOOT, NEST_LOADBALANCE] }),
        TerminusModule.forRootAsync({
            useFactory: () => ({ endpoints: [{ url: '/health', healthIndicators: [] }] }),
        }),
    ]
})
export class AppModule {
}

Samples

Samples

Who used

焱融云

Stay in touch

License

NestCloud is MIT licensed.

0.7.3-node1011

3 years ago

0.7.13-node1011

3 years ago

0.7.17

4 years ago

0.6.13

4 years ago

0.7.16

4 years ago

0.6.12

4 years ago

0.7.15

4 years ago

0.7.14

4 years ago

0.7.13

4 years ago

0.7.12

4 years ago

0.7.11

4 years ago

0.7.10

4 years ago

0.7.9-2

4 years ago

0.7.9-1

4 years ago

0.7.9-0

4 years ago

0.7.9

4 years ago

0.7.8-0

4 years ago

0.7.8

4 years ago

0.7.6

4 years ago

0.7.5

4 years ago

0.7.2

4 years ago

0.7.1

4 years ago

0.7.0

4 years ago

0.6.10-22

4 years ago

0.6.10

4 years ago

0.6.11

4 years ago

0.6.10-18

4 years ago

0.6.10-20

4 years ago

0.6.10-21

4 years ago

0.6.10-19

4 years ago

0.6.10-15

4 years ago

0.6.10-16

4 years ago

0.6.10-17

4 years ago

0.6.10-14

4 years ago

0.6.10-13

4 years ago

0.6.10-12

4 years ago

0.6.10-6

4 years ago

0.6.10-7

4 years ago

0.6.10-11

4 years ago

0.6.10-10

4 years ago

0.6.10-8

4 years ago

0.6.10-9

4 years ago

0.6.10-5

4 years ago

0.6.10-4

4 years ago

0.6.10-3

4 years ago

0.6.10-2

4 years ago

0.6.10-1

4 years ago

0.6.10-0

4 years ago

0.6.9

4 years ago

0.6.8

4 years ago

0.6.7

4 years ago

0.6.6

4 years ago

0.6.5

4 years ago

0.6.4

4 years ago

0.6.3

4 years ago

0.6.0

4 years ago

0.6.0-y.4

4 years ago

0.6.0-y.3

4 years ago

0.6.0-y.2

4 years ago

0.6.0-y.1

4 years ago

0.6.0-y.0

4 years ago

0.6.0-4

4 years ago

0.6.0-3

4 years ago

0.6.0-2

4 years ago

0.6.0-1

4 years ago

0.6.0-0

4 years ago

0.5.3

4 years ago

0.5.2

5 years ago

0.5.1

5 years ago

0.5.0-9

5 years ago

0.5.0-8

5 years ago

0.5.0-7

5 years ago

0.5.0-6

5 years ago

0.5.0-5

5 years ago

0.5.0-4

5 years ago

0.5.0-3

5 years ago

0.5.0-2

5 years ago

0.5.0-1

5 years ago

0.5.0-0

5 years ago

0.4.5-3

5 years ago

0.4.5-2

5 years ago

0.4.5-1

5 years ago

0.4.5-0

5 years ago

0.4.4

5 years ago

0.4.3

5 years ago

0.4.2

5 years ago

0.4.1

5 years ago

0.4.0

5 years ago

0.3.17

5 years ago

0.3.16

5 years ago

0.3.16-0

5 years ago

0.3.15

5 years ago

0.3.14

5 years ago

0.3.14-2

5 years ago

0.3.14-1

5 years ago

0.3.14-0

5 years ago

0.3.13

5 years ago

0.3.12

5 years ago

0.3.10

5 years ago

0.3.9

5 years ago

0.3.9-0

5 years ago

0.3.8

5 years ago

0.3.8-5

5 years ago

0.3.8-4

5 years ago

0.3.8-3

5 years ago

0.3.8-2

5 years ago

0.3.8-1

5 years ago

0.3.8-0

5 years ago

0.3.7

5 years ago

0.3.6

5 years ago

0.3.5

5 years ago

0.3.4

5 years ago

0.3.3

5 years ago

0.3.2

5 years ago

0.3.1

5 years ago

0.3.0

5 years ago

0.2.5-3

5 years ago

0.2.5-2

5 years ago

0.2.5-1

5 years ago

0.2.5-0

5 years ago

0.2.4

5 years ago

0.2.4-3

5 years ago

0.2.4-2

5 years ago

0.2.4-1

5 years ago

0.2.4-0

5 years ago

0.2.3

5 years ago

0.2.2

5 years ago

0.2.1

5 years ago

0.2.1-5

5 years ago

0.2.1-4

5 years ago

0.2.1-3

5 years ago

0.2.1-2

5 years ago

0.2.1-1

5 years ago

0.2.1-0

5 years ago

0.3.0-beta4

5 years ago

0.3.0-beta3

5 years ago

0.3.0-beta2

5 years ago

0.3.0-beta1

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago