This Node.js application demonstrates how to implement captcha verification using Google's reCAPTCHA service.
- Node.js installed on your machine
- An internet connection to communicate with Google's reCAPTCHA service
-
Clone or download the repository.
-
Navigate to the project directory in your terminal.
-
Install dependencies by running:
npm install
Before running the application, you need to set up your Google reCAPTCHA secret key.
-
Obtain your Google reCAPTCHA secret key from the reCAPTCHA admin console.
-
Replace the value of
GOOGLE_RECAPTCHA_SECRET
in theserver.js
file with your secret key:const GOOGLE_RECAPTCHA_SECRET = 'YOUR_SECRET_KEY_HERE';
-
Start the server by running:
node server.js
-
Open your web browser and navigate to
http://localhost:3000
. -
Fill out and submit the form on the webpage. If the captcha verification is successful, you will receive a "Captcha ok!" response.
POST /submit
: Endpoint for submitting the captcha response.
- If captcha verification fails, an appropriate error message will be returned.
- The server responds with a 404 error for any invalid routes.
This project is licensed under the MIT License.