Socket
Socket
Sign inDemoInstall

@nestjs/axios

Package Overview
Dependencies
Maintainers
2
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nestjs/axios

Nest - modern, fast, powerful node.js web framework (@axios)


Version published
Weekly downloads
1.8M
increased by5.44%
Maintainers
2
Weekly downloads
 
Created

What is @nestjs/axios?

The @nestjs/axios package is a module for the NestJS framework that provides integration with Axios, a popular HTTP client, for making HTTP requests from your NestJS applications. It simplifies the process of sending HTTP requests and handling responses, allowing developers to easily communicate with external APIs or services.

What are @nestjs/axios's main functionalities?

HTTP GET Request

This feature allows you to perform HTTP GET requests to retrieve data from a specified resource. The code sample demonstrates how to make a GET request to an external API and log the response data.

this.httpService.get('https://api.example.com/data').subscribe(response => console.log(response.data));

HTTP POST Request

This feature enables you to send HTTP POST requests to a specified resource, allowing you to submit data to be processed by the resource. The code sample shows how to make a POST request with a JSON body and log the response.

this.httpService.post('https://api.example.com/data', { key: 'value' }).subscribe(response => console.log(response.data));

Interceptors

Interceptors allow you to intercept requests or responses before they are handled by then or catch. This feature is useful for logging, authentication, or any other global request/response modification. The code sample demonstrates how to log a message every time a request is sent.

axios.interceptors.request.use(config => { console.log('Request was sent'); return config; }, error => { return Promise.reject(error); });

Other packages similar to @nestjs/axios

FAQs

Package last updated on 14 Aug 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc