0.0.1 • Published 11 months ago

nestjs-airtable v0.0.1

Weekly downloads
-
License
UNLICENSED
Repository
github
Last release
11 months ago

Description

A dynamic module for configuring Airtable in a Nest framework TypeScript project.

Installation

npm install nestjs-airtable

Getting Started

The Airtable Module exposes two static methods to configure the Airtable client: forRoot() and forRootAsync().

Configuration

import { Module } from '@nestjs/common'
import { ConfigModule, ConfigService } from '@nestjs/config'
import { AirtableModule } from 'nestjs-airtable'

@Module({
  imports: [
    AirtableModule.forRoot({
      apiKey: 'someSecretApiKey',
    }),
  ],
})
export class MyModule {}

Async Configuration

import { Module } from '@nestjs/common'
import { ConfigModule, ConfigService } from '@nestjs/config'
import { AirtableModule } from 'nestjs-airtable'

@Module({
  imports: [
    AirtableModule.forRootAsync({
      imports: [ConfigModule],
      inject: [ConfigService],
      useFactory: (configService: ConfigService) => ({
        apiKey: configService.getOrThrow('AIRTABLE_API_KEY'),
      }),
    }),
  ],
})
export class MyModule {}

Contribute

Feel free to fork the repo and open a pull-request to contribute to the project directly, or submit an issue if you find a bug.