Node.js - Axios support


This section describes support for the Node.js Axios related frameworks.

The following packages are supported:

Library Supported versions
axios 0.x; 1.x
@nestjs/axios 1.x; 2.x; 3.x
vue-axios 1.x; 2.x; 3.x

Support example for axios

The analysis of the following code will create a NodeJS Put HttpRequest service named foo/put/ with a callLink from my_func to that request:

import * as axios from 'axios';

function my_func(){
  axios('foo/put', {method:'put'})
    .then(function (response) {
      // handle success
      console.log(response);
    })
}

Support example for @nestjs/axios

Whenever an API call to one of an HTTP method of an HttpService (from @nestjs/axios) instance is found a Request service object is created with a callLink from the caller.

For instance when analyzing the following source code:

import { HttpService } from '@nestjs/axios'

export class AppService {
  constructor(
    private cacheManager: Cache,
    private readonly httpService: HttpService
  ) {}

  async foocaller(params) {
      this.httpService.post('foo/post', params)
  }
}

you will get the following result:

Support example for vue-axios

Whenever an axios instance is added to an application as follows

import * as Vue from 'vue' // in Vue 3
import axios from 'axios'
import VueAxios from 'vue-axios'

const app = Vue.createApp(...)
app.use(VueAxios, axios)

and this axios instance is used within the vue application such as:

  export default {
    name: 'App',
    methods: {
      getList() {
        this.axios.get("foo/get").then((response) => {
          console.log(response.data)
        })
      }
    }
  }

A request service is created by this extension with a callLink from the caller: