ngx-sails-socketio
An Angular module for connecting to your SailsJs Backend/API through SocketIO.
Installation
npm i ngx-sails-socketio
Usage
Add SailsModule
to your application module.
// Override options to configure connection to your sailsjs backend;
An implementation of the AuthInterceptor class
Inject the Sails
into your components/services and instatiate classes specific to your objective.
API
class SailsRequest
Makes a request for a resource to the configured sails server. Has methods that maps to the various supported RESTful API verbs.
Methods
- get(url:
string
):Observable<SailsResponse>
- post(url:
string
, data:any
):Observable<SailsResponse>
- put(url:
string
, data:any
):Observable<SailsResponse>
- patch(url:
string
, body:any
):Observable<SailsResponse>
- delete(url:
string
):Observable<SailsResponse>
class SailsSubscription
A class for subscribing to resourceful Pub-Sub events emitted from a sailsjs backend.
Methods
- on(eventName:
string
):Observable<SailsEvent>
- off(eventName:
string
):Observable<SailsEvent>
Example(s)
Under construction
class SailsEvent
A class representing an event on a resource from the server. This follows the structure as described in the sailsjs Pub-Sub event documentation.
class SailsQuery
A class for querying records from the server. Similar to SailsRequests
but has methods mapping actions as detail on waterline api used by sailsjs.
interface SailsInterceptorInterface
An interface to construct an iterceptor to use for requests.
Example(s)
An authentication interceptor to set the Authorization header on every request.