Socket
Socket
Sign inDemoInstall

@nestjs/axios

Package Overview
Dependencies
21
Maintainers
2
Versions
17
Alerts
File Explorer

Advanced tools

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.7M
increased by0.38%
Maintainers
2
Install size
18.6 kB
Created
Weekly downloads
 

Package description

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

Readme

Source

Nest Logo

A progressive Node.js framework for building efficient and scalable server-side applications.

NPM Version Package License NPM Downloads Coverage Discord Backers on Open Collective Sponsors on Open Collective

Description

Axios module for Nest.

The HttpModule module exposes Axios-based methods to perform HTTP requests. This library also transforms the resulting HTTP responses into Observables (from RxJS).

Installation

$ npm i --save @nestjs/axios axios

Quick Start

Overview & Tutorial

Support

Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please read more here.

Stay in touch

License

Nest is MIT licensed.

FAQs

Last updated on 07 Feb 2024

Did you know?

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc