🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

@navios/angular-module

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@navios/angular-module

0.3.0-alpha.2
latest
npm
Version published
Maintainers
1
Created
Source

Navios Angular 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/angular-module

or

yarn add @navios/angular-module

Integration app.config.ts

import { NaviosModule } from '@navios/angular-module'

export const appConfig: ApplicationConfig = {
  providers: [
    //...
    NaviosModule.provideNavios({
      baseURL: 'https://example.com/',
    }),
    //...
  ],
}

Usage

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

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

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

    //...
  }
}

FAQs

Package last updated on 11 Nov 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts