JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 244
  • Score
    100M100P100Q75304F
  • License MIT

Undici utilities module based on the @nodejs/undici package 🌐

Package Exports

  • nestjs-undici
  • nestjs-undici/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (nestjs-undici) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

codecov

Node.js build and publish package

Running Code Coverage

TypeScript Nestjs Free. Built on open source. Runs everywhere. GitHub Actions

Installation

Install with yarn or npm: yarn or npm:

# yarn
yarn add nestjs-undici
# npm
npm i nestjs-undici --save

Usage example:

Project example: https://github.com/hebertcisco/nestjs-techniques-undici

// app.module.ts
import { Module } from '@nestjs/common';
import { HttpModule } from 'nestjs-undici';

import { AppController } from './app.controller';
import { AppService } from './app.service';

@Module({
    imports: [
        HttpModule.register({
            headers: {
                'my-header': `foo-bar`,
            },
        }),
    ],
    controllers: [AppController],
    providers: [AppService],
})
export class AppModule {}
// app.service.ts
import { lastValueFrom } from 'rxjs';

import { Injectable } from '@nestjs/common';
import { HttpService } from 'nestjs-undici';

@Injectable()
export class AppService {
    constructor(private httpService: HttpService) {}
    public fetchExternalInfo = async () => {
        const baseURL = 'https://api.github.com';
        try {
            const result = this.httpService.request(`${baseURL}/repos/hebertcisco/undici`);

            const response = await lastValueFrom(result);

            return response.body.json();
        } catch (error) {
            throw error;
        }
    };
}

🤝 Contributing

Contributions, issues and feature requests are welcome!
Feel free to check issues page.

Show your support

Give a ⭐️ if this project helped you!

Or buy me a coffee 🙌🏾

📝 License

Copyright © 2022 Hebert F Barros.
This project is MIT licensed.