Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

14 Commits

Repository files navigation

express-hcaptcha

Node.js CI

Validate your hCaptcha token using a middleware.

Usage

npm install --save express-hcaptcha
constbodyParser=require('body-parser');constcors=require('cors');constexpress=require('express');consthcaptcha=require('express-hcaptcha');// your hcaptcha secret keyconstSECRET=process.env.HCAPTCHA_SECRET_KEY;constPORT=process.env.PORT||8080;constapp=express();// middlewareapp.use(cors());app.use(bodyParser.json());// required by express-hcaptcha// validate the token and proceed to the route when token is valid// the middleware also sets the req.hcaptcha to what ever the verify call returnsapp.post('/verify',hcaptcha.middleware.validate(SECRET),(req,res)=>{res.json({message: 'verified!',hcaptcha: req.hcaptcha});});app.listen(PORT,()=>{console.log(`listening on http://0.0.0.0:${PORT}`);});

About

A light middleware for Express.js to verify an hCaptcha token

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages