0.0.2 • Published 1 year ago

@eqxjs/ambassador v0.0.2

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

Equinox 2 Ambassador

Ambassador is a Javascript library for nestjs.

Installation

Use the node package manager npm to install Ambassador.

npm install @eqxjs/ambassador

HTTP Usage

import { Module } from '@nestjs/common';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import {HttpModule} from '@eqxjs/ambassador'

@Module({
  imports: [
    HttpModule.register({
      timeout: 5000,
      maxRedirects: 5,
    }),
  ],
  controllers: [AppController],
  providers: [
    AppService,
  ],
})
export class AppModule {}
import { Injectable } from '@nestjs/common';
import {HttpService} from '@eqxjs/ambassador'
import {firstValueFrom} from 'rxjs'

@Injectable()
export class AppService {
  constructor(private readonly httpService: HttpService){}
  async getHello(): Promise<string> {
    const observ = this.httpService.get<string>('http://localhost:3000/data');
    const {data} = await firstValueFrom(observ);
    return data;
  }
}

Mongo Usage

GraphQL Usage

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT