A simple implementation of the google reCAPTCHA v2 using react for the client side and Node for the server side
This example show how to use
< google reCAPTCHA v2 | I'm not a robot checkbox >
in a simple register form
git clone https://github.com/azouaoui-med/reCaptcha-react-node.git
First you need to get reCAPTCHA site and secret keys, see Google reCAPTCHA
-
Server
- cd into the server folder
cd server
- run
yarn
ornpm install
- open file in directory
server/reCaptcha.middleware.js
,you can add your secret key by updating the variableRECAPTCHA_SITE_KEY
, or add it as an environement variable - start server by running
yarn start
ornpm start
- cd into the server folder
-
Client
- cd into the client folder
cd client
- run
yarn
ornpm install
- open file in directory
client/src/Recaptcha/Recaptcha.js
and add your site key by updating the variableRECAPTCHA_SITE_KEY
- open file in directory
client/src/setupProxy.js
and make sure you have the correct server urlproxy({target: '< Your Server URL >', ...}]
- run
yarn start
ornpm start
to start the development server
- cd into the client folder