Skip to content

Axios tutorial shows how to generate requests in JavaScript using Axios client library.

Notifications You must be signed in to change notification settings

thedvlprs/axios

Repository files navigation

Axios tutorial

Axios tutorial shows how to generate requests in JavaScript using Axios client library.

Axios

Axios is a promise based HTTP client for the browser and Node.js. Axios makes it easy to send asynchronous HTTP requests to REST endpoints and perform CRUD operations. It can be used in plain JavaScript or with a library such as Vue or React.

In this tutorial we work with Axios in a Node.js application.

Setting up Axios

First, we install Axios.

$ node -v
v14.5.0

We use Node.js version 14.5.

$ npm init -y

We initiate a new Node.js application.

$ npm i axios

We install Axios with npm i axios command.

Axios Response object

When we send a request to a server, it returns a response. The Axios response object consists of:

  • data - the payload returned from the server
  • status - the HTTP code returned from the server
  • statusText - the HTTP status message returned by the server
  • headers - headers sent by server
  • config - the original request configuration
  • request - the request object

About

Axios tutorial shows how to generate requests in JavaScript using Axios client library.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published