lividavi19 / async-fetch

Lightweight Javascript library to make async requests to a server, it implements the browser's fetch api

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ASYNC FETCH

Lightweight javascript library to make async requests to a server, it implements the browser's fetch API. The library contains four utilities functions, each one will help a client make GET, POST, PUT and DELETE requests to a server.

Table of Contents

Installation Usage Examples Error Handling Response Formats

A : INSTALLATION

To start making HTTP requests in your project, include the library to your source code as follows;

<script src="/Path/async-fetch.js"></script>

Replace "/Path/async-fetch.js" with the actual path to the JS file containing the utility functions (the library).

B : USAGE

All utility functions in this library have the following in common;

i) Url

Each function requires a URL parameter that specifies the location to which the HTTP request will be made.

ii) Options Object

This is an object used to customize the request. This object can include properties such as headers, body, etc. Sometimes your code may not require to pass headers object, in this case pass an empty object {} as an argument to avoid getting unexpeted results.

iii) Success Callback

A callback function used to handle successful response. It receives an object containing various response formats like JSON, TEXT and BLOB.

iv) Failure Callback

A callback function used to handle errors that may occur during the fetch operation.

C : EXAMPLES

This section is currently being prepared, please come back later!

D : ERROR HANDLING

This section is currently being prepared, please come back later!

E : RESPONSE FORMATS

This section is currently being prepared, please come back later!

About

Lightweight Javascript library to make async requests to a server, it implements the browser's fetch api

License:MIT License


Languages

Language:JavaScript 100.0%