nestjs-axios-promise
v1.0.0
Published
[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/jasonraimondi/nestjs-axios-promise/nodejs?label=Unit%20Tests&style=flat-square)](https://github.com/jasonraimondi/nestjs-axios-promise) [![Test Coverage](https://img.shields.io/codec
Downloads
194
Readme
Nest.js Axios Promise
A thin wrapper around Axios for Nest.js using Promises.
Install
pnpm add nestjs-axios-promise
Usage
import { AxiosService } from "./axios.service";
@Module({
imports: [AxiosModule.register()],
providers: [MyCustomService],
})
export class AppModule {}
@Injectable()
export class MyCustomService {
constructor(private readonly http: AxiosService) {}
async doWork() {
const response = await this.http.get("/");
console.log(response);
}
}
Custom Config
@Module({
imports: [
AxiosModule.register({
baseURL: "https://example.com",
headers: {
"X-My-Header": "Is a value!",
},
}),
],
})
export class AppModule {}