New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

ngx-sails

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ngx-sails

Sails client for Angular (2+)

latest
Source
npmnpm
Version
0.5.0
Version published
Weekly downloads
1
-50%
Maintainers
1
Weekly downloads
 
Created
Source

ngx-sails

npm version Build Status Coverage Status

A socket client for Angular (2+) applications that connect to a Sails socket.io API.

Installation

npm install ngx-sails

Usage

Add SailsClientModule to your application module.

// Optional, the URI will default to origin
const socketConfig: ISailsClientConfig = { uri: 'http://localhost:3000' };

@NgModule({
 declarations: [
   AppComponent
 ],
 imports: [
   SailsClientModule.configureClient(socketConfig),
   ...
 ],
 providers: [],
 bootstrap: [AppComponent]
})

export class AppModule { }

Inject the SailsClient into your component.

class ExampleComponent implements OnInit {

 someData: any;

 constructor(private sails: SailsClient) { }

 $onInit() {
   this.sails.get('/api/url').subscribe(res => {
     this.someData = res.data;
   });
 }

}

API

Methods

  • get(url: string, options: ISailsRequestOpts): Observable<SailsResponse>
  • post(url: string, body: any, options: ISailsRequestOpts): Observable<SailsResponse>
  • put(url: string, body: any, options: ISailsRequestOpts): Observable<SailsResponse>
  • patch(url: string, body: any, options: ISailsRequestOpts): Observable<SailsResponse>
  • delete(url: string, options: ISailsRequestOpts): Observable<SailsResponse>
  • head(url: string, options: ISailsRequestOpts): Observable<SailsResponse>
  • options(url: string, options: ISailsRequestOpts): Observable<SailsResponse>
  • on(event: string): Observable<any>

Properties

  • requestErrors: Observable<SailsError>
interface ISailsClientConfig {
  uri?: string,
  headers?: any,
  options?: SocketIOConnectOpts
}

interface ISailsRequestOpts {
  headers?: any
  params?: any
  search?: any
}

class SailsResponse {
  data: any
  status: number
  headers: any
  config: ISailsRequest
}

class SailsError {
  error: any
  headers: any
  status: number
  config: ISailsRequest
}

interface ISailsRequest {
  url: string
  method: RequestMethod
  headers?: any
  data?: any
  params?: any
}

Keywords

angular

FAQs

Package last updated on 25 Dec 2017

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