@navios/nestjs-module

0.3.0-alpha.0 • Public • Published

Navios NestJs Module

axios replacement for Angular with axios API based on native fetch implementation.

Why?

axios is a great library, but it has some issues:

  • It's not using native fetch API, so it's slow and buggy on backend
  • It's not supporting Next.JS caching mechanism

Installation

npm install --save @navios/nestjs-module

or

yarn add @navios/nestjs-module

Integration in Module

import { Module } from '@nestjs/common';
import { NaviosModule } from '@navios/nestjs-module';


@Module({
  imports: [
    NaviosModule.register({
      baseURL: 'https://example.com/',
    }),
    //...
  ],
  //...
})

Usage

import { Inject, Injectable } from '@nestjs/core'
import type { NaviosError, NaviosService } from '@navios/angular-module'

@Injectable({})
export class SomeService {
  constructor(@Inject(NaviosService) private readonly navios: NaviosService) {}

  async load(uri, urlParams) {
    const response = await this.navios.get<MyResponse>(uri, {
      params: urlParams,
    })

    //...
  }
}

Readme

Keywords

none

Package Sidebar

Install

npm i @navios/nestjs-module

Weekly Downloads

1

Version

0.3.0-alpha.0

License

MIT

Unpacked Size

75.2 kB

Total Files

25

Last publish

Collaborators

  • arilas