Giter Club home page Giter Club logo

axios's Introduction

axios

Used JSON placeholder,fake REST API for our data

Axios is an HTTP client library based on promises, which helps to make request to your own backend or a 3rd party API to fetch data, which is almost similar to the FETCH API that's built into the browser. It makes sending asynchronous HTTP requests to REST endpoints easier and helps you perform CRUD operations. Axios is more simpler and can be used with node.js and perform complex tasks.

The GET request :

Send a request to the API and recieves a response with a status of 200 along with headers, data and config. The data limit is set to 5 objects.

The POST request:

Generates a response of the data sent that is send to the server in the form of Objects.

The PUT request:

Replaces the entire resource while updating data, the ID is included in the URL, with the method being PUT.

The PATCH request:

Updates data incrementally and not the entire resource.

The DELETE request:

Takes in the ID and deletes the given record and it returns an empty object.

The SIMS(Simultaneous requests):

Can perform multiple requests using axios.all() which takes in an array of requests, and when all the promises are fulfiled, we then get our response and handle it.

AN INTERCEPTORS:

Every time a request is made, an interceptor, captures the info about the request and is displayed on the console.

CUSTOM HEADERS:

Mainly used in authentication with JSON web tokens, while making a request to login, validating the login and when we get back a token we have to send that token in the header to access protected routes, stored in the config of the headers section.

TRANSFORM RESPONSES:

Used to transform requests and responses.

ERRORS:

Used to handle error.We can perform some kind of functionality based on the errors

CANCEL TOKENS:

We can cancel any requests on the fly, by using axios.CancelToken.source()

axios's People

Contributors

anniepauline avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.