1.0.0 • Published 5 years ago

rx-http-observable v1.0.0

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

rx-http-observable

This Package rx-http lets you make HTTP requests, like GET, POST, PUT, PATCH, DELETE and HEAD.

This plugin is compatible with Angular, React, Node and Javascript projects.

Installation

Using npm: $ npm i rx-http-observable

// using ES6 modules
import { RxHttpObservable } from 'rx-http-observable';
var http = new RxHttpObservable();

// using CommonJS modules
var http = require('rx-http-observable')
var http = new http.RxHttpObservable();

Usage

Use these specific methods:

First, you need to know how parameters work:

Parameters:

URL: Address of your service. QueryParams: Query parameters are a defined set of parameters attached to the end of a url. They are extensions of the URL that are used to help define specific content or actions based on the data being passed. Headers: HTTP header fields are components of the header section of request and response messages in the Hypertext Transfer Protocol (HTTP). They define the operating parameters of an HTTP transaction. Body: Content to send

After this, you can use the methods:

GET

The GET method is used to retrieve information from the given server using a given URI.

this.http.get(URL, QueryParms, Headers).subscribe( res => {
    console.log(res);
});

POST

A POST request is used to send data to the server, for example, customer information, file upload, etc.

this.http.POST(URL, Body, QueryParms, Headers).subscribe( res => {
  console.log(res);
});

PUT

Replaces all current representations of the target resource with the uploaded content.

this.http.put(URL, Body, QueryParms, Headers).subscribe( res => {
    console.log(res);
});

PATCH

Replaces partial current representations of the target resource with the uploaded content.

this.http.patch(URL, Body, QueryParms, Headers).subscribe( res => {
    console.log(res);
});

DELETE

Removes all current representations of the target resource given by a URI.

this.http.delete(URL, QueryParms, Headers).subscribe( res => {
    console.log(res);
});

REQUEST

This is a generic way to call a method(GET, POST, PUT, PATCH and DELETE)

this.http.request(Method, URL, QueryParms, Headers).subscribe( res => {
    console.log(res);
});
1.0.0

5 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago