nest-google-recaptcha
    TypeScript icon, indicating that this package has built-in type declarations

    0.2.0 • Public • Published

    Google recaptcha module

    Install

    $ npm i nest-google-recaptcha
    

    Configuration

    @Module({
        imports: [
            GoogleRecaptchaModule.forRoot({
                secretKey: process.env.GOOGLE_RECAPTCHA_SECRET_KEY,
                version: 3,     // Optional, for V3
                minScore: 0.5,  // Optional, for V3
                response: req => req.headers.authorization,
                skipIf: req => process.env.NODE_ENV !== 'production',
                onError: e => {
                    throw new BadRequestException('Invalid recaptcha.')
                }
            })
        ],
    })
    export class AppModule {
    }

    Usage

    @Controller('feedback')
    export class FeedbackController {
        @Recaptcha()
        @Post('send')
        async send(): Promise<any> {
            // TODO: Implement it.
        }
    }

    Enjoy!

    Install

    npm i nest-google-recaptcha

    DownloadsWeekly Downloads

    3

    Version

    0.2.0

    License

    MIT

    Unpacked Size

    18.6 kB

    Total Files

    33

    Last publish

    Collaborators

    • jostrander