Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@spreadmonitor/network

Package Overview
Dependencies
Maintainers
2
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@spreadmonitor/network

Universal network layer for our Angular applications.

  • 8.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
16
decreased by-11.11%
Maintainers
2
Weekly downloads
 
Created
Source

Network Module

This modules is an universal network layer.

Installation

Install the package

npm install @spreadmonitor/network

NOTE: This package has a peer-dependency of some @angular/* packages..

Import the module

After successful install, import the NetworkModule into your root NgModule.

import { NetworkModule, NetworkAuthService } from '@spreadmonitor/network';

@NgModule({
  declarations: [AppComponent],
  imports: [
    BrowserModule,
    HttpClientModule,
    NetworkModule.forRoot({
      /**
       * Base endpoint for the API.
       * Notice there is no slash in the end.
       */
      baseUrl: 'https://api.your-beautiful-api.com',
      /**
       * Type of the auth method.
       *
       * Valid values are 'basic' or 'bearer'.
       */
      authType: 'bearer',
    })
  ],
  providers: [
    /**
     * AuthService is your own implementation, which must have a
     *  - token: string property
     *  - authenticated: boolean property
     */
    { provide: NetworkAuthService,  useExisting: AuthService, }
  ]
  bootstrap: [AppComponent],
})
export class AppModule {}

Usage

@Component()
class CustomComponent {

  constructor(
    private network: NetworkService;
  );

  public getSomething(path: string) {
    this.network.get(path, { queryParamOne = 4, boolean: true, stringValue: 'yay' }).subscribe(response => {
      console.log('Response arrived', response);
    });
  }

  public postSomething(path: string) {
    this.network.get(path, { myData: 5 } { queryParamOne = 4, boolean: true, stringValue: 'yay' }).subscribe(response => {
      console.log('Payload sent, response arrived', response);
    });
  }
}

Contributing

Before contributing to this package please make sure you have read our CONTRIBUTING guide.

Package owners

This package is authored by these developers:

To land any feature beside bug-fixes you need to triage your feature request with them.

FAQs

Package last updated on 08 Aug 2019

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc