1.1.7 • Published 9 months ago

@cin12211/nestjs-cloudflare v1.1.7

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

Description

OpenAPI (Cloudflare) module for Nest.

Installation

$ npm i --save npm i @cin12211nestjs-cloudflare 

$ yarn add @cin12211nestjs-cloudflare 

$ pnpm add @cin12211nestjs-cloudflare

Quick Start

API Keys

Set your account email address and API key. The API key can be found on the My Profile -> API Tokens page in the Cloudflare dashboard.

import { Module } from '@nestjs/common';
import {CloudflareModule} from "@cin12211/nestjs-cloudflare"

@Module({
  imports: [
     ...,
     CloudflareModule.forRoot({
      key: process.env.CLOUDFLARE_API_KEY as string,
      email: process.env.CLOUDFLARE_EMAIL as string,
    }),
    ...,
  ],
})
export class AppModule {}

API Tokens (BETA)

Create your token on the My Profile -> API Tokens page in the Cloudflare dashboard.

import { Module } from '@nestjs/common';
import {CloudflareModule} from "@cin12211/nestjs-cloudflare"

@Module({
  imports: [
     ...,
     CloudflareModule.forRoot({
      token: process.env.CLOUDFLARE_TOKEN as string,
    }),
    ...,
  ],
})
export class AppModule {}

Usage

import { Injectable } from '@nestjs/common';
import {CloudflareService} from "@cin12211/nestjs-cloudflare"


@Injectable()
export class YourService {
  constructor(
    private readonly cloudflare:CloudflareService,
  ) {}
  
    async getZones(){
        return await this.cloudflare.zones.browse()
    }

    async getZone(zoneId:string){
        return await this.cloudflare.zones.read(zoneId)
    }

    // get zone dns records
    async getZoneDnsRecords(zoneId:string){
        return await this.cloudflare.dnsRecords.browse(zoneId)
    }

    ...
}

Features

  • Zones
  • DNS records for a zone

Stay in touch

License

Distributed under the MIT License. See LICENSE for more information.

Acknowledgments

1.1.7

9 months ago

1.1.6

9 months ago

1.1.4

9 months ago

1.1.3

9 months ago

1.1.2

9 months ago

1.1.1

9 months ago

1.1.0

9 months ago

1.0.9

9 months ago

1.0.8

9 months ago

1.0.7

9 months ago

1.0.6

9 months ago

1.0.5

9 months ago

1.0.4

9 months ago

1.0.3

9 months ago

1.0.2

9 months ago

1.0.1

9 months ago

1.0.0

9 months ago