Express middleware for Google reCAPTCHA integration (v2 and v3). Current stable version is 5.1.0, with TypeScript support added in v4.0.0. The library provides simple middleware methods to render captcha widgets and verify tokens. v3.0.0 introduced breaking changes: the module now exports a class constructor instead of an instance, the 'recaptcha' property is set on the response object rather than the request, and the verify result format changed. Alternative packages include 'recaptcha-v2' and 'google-recaptcha', but express-recaptcha offers a straightforward express-centric API.
npm install express-recaptchaVerified import paths — ran on the pinned version, not inferred.
Shows how to use RecaptchaV3 middleware to render captcha and verify token in Express routes.
Replace Recaptcha.init(site, secret) with new Recaptcha(site, secret).
Update your templates to use res.recaptcha instead of req.recaptcha.
Refer to v3 changelog for updated verify result format.
No action needed; but if using @types/express-recaptcha, remove it.
Use named import or destructure the require result.
Use: const { RecaptchaV3 } = require('express-recaptcha'); then new RecaptchaV3(...).Ensure you created instance with new RecaptchaV3(site, secret) (v3+).
Run npm install express-recaptcha and check the import statement.
Use res.recaptcha in your templates or handlers.