☁️ Cloudflare Turnstile integration for NestJS
- 🧩 Simple and easy - This library provides just one guard to protect your endpoints with Cloudflare Turnstile Captcha!
Installation:
npm install nest-cloudflare-turnstile --save
add module to imports array:
imports: [TurnstileModule.forRoot({
secretKey: '1x0000000000000000000000000000000AA',
tokenResponse: (req) => req.body.turnstileToken // or you can use req.headers.turnstileToken
})],
use TurnstileCaptcha
decorator on controller:
import { TurnstileCaptcha } from 'nest-cloudflare-turnstile'
@Post()
@TurnstileCaptcha()
getHello(): string {
return this.appService.getHello();
}
And thats it! For more information, please check the docs
MIT LICENSE | Halit Sever