New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

express-hcaptcha

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

express-hcaptcha

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

  • 0.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
67
decreased by-49.24%
Maintainers
1
Weekly downloads
 
Created
Source

express-hcaptcha

Validate your hCaptcha token using a middleware.

Usage

npm install --save express-hcaptcha
const bodyParser = require('body-parser');
const cors = require('cors');
const express = require('express');
const hcaptcha = require('express-hcaptcha');

// your hcaptcha secret key
const SECRET = process.env.HCAPTCHA_SECRET_KEY;
const PORT = process.env.PORT || 8080;

const app = express();

// middleware
app.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 returns
app.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}`);
});

Todo

  • tests
  • setup CI

Keywords

FAQs

Package last updated on 06 Dec 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc