UNPKG

@eqxjs/ambassador

Version:

Equinox version 2 ambassador module for nestjs

63 lines (48 loc) 1.41 kB
# Equinox 2 Ambassador Ambassador is a Javascript library for nestjs. ## Installation Use the node package manager [npm](https://www.npmjs.com/get-npm) to install Ambassador. ```bash npm install @eqxjs/ambassador ``` ## HTTP Usage ```node.js 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 {} ``` ```node.js 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](https://choosealicense.com/licenses/mit/)