New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

nestjs-http-manager

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nestjs-http-manager

Обертка над http-модулем с использованием реактивного программирования и отловом ошибок для nestjs

0.1.6
npm
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

Инструкция по эксплуатации

Установка

yarn add nestjs-http-manager

// или

npm i nestjs-http-manager

Интеграция с nestjs-модуляим

Для использования данной библиотеки в своем проекте, необходимо:

  • Импортировать HttpManagerModule в ваш модуль
@Module({
  imports: [
    ..., HttpManagerModule, ...
  ],
  controllers: [...],
  providers: [...],

})
  • Сделать инъекцию HttpManagerService в конструкторе вашего сервиса
constructor(private readonly httpManager: HttpManagerService) {}

Готово! Сервис может использоваться

Выполнение запроса

GET-запрос

...
const res: YourType = await this.httpManager.get<YourType>(
'http://example.com', {headers: {'Authorization': 'Bearer ...'}}
)
...

Аналогично и для POST-запроса

...
const res: YourType = await this.httpManager.post<YourType>(
'http://example.com', {
	data: {key: value},
	headers: {'Authorization': 'Bearer ...'}
})
...

Можно также не передавать options и оставить только url

FAQs

Package last updated on 16 Jun 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