examples/js
2024-10-03 18:01:58 +00:00
..
src feat: reuse init 2024-01-08 02:22:08 +05:30
views feat: add javascript example server 2024-01-07 23:05:24 +05:30
.env_sample feat: add javascript example server 2024-01-07 23:05:24 +05:30
.gitignore feat: add javascript example server 2024-01-07 23:05:24 +05:30
.nvmrc chore(deps): update dependency node to v20.18.0 2024-10-03 18:01:58 +00:00
LICENSE.md feat: include license file with each example 2024-01-18 10:10:09 +05:30
package-lock.json feat: add javascript example server 2024-01-07 23:05:24 +05:30
package.json feat: add javascript example server 2024-01-07 23:05:24 +05:30
README.md feat: add javascript example server 2024-01-07 23:05:24 +05:30

Example Server with mCaptcha protection

The example server shows a dummy form with the mCaptcha widget. When the form is submitted, it validates the authorization token presented by the visitor against the mCaptcha instance that the server is configured with.

The example server is built with Express (JavaScript) webframework and uses the JavaScript API library for mCaptcha for validation.

1. Configuration

Before running, please configure the server:

cp .env_sample .env

And fill in the configuration parameters in .env file with:

  1. Sitekey
  2. Account secret: Available in the settings page on the mCaptcha dashboard
  3. Instance URL

2. Install dependencies

Tested with Node v20.

npm install

3. Launch server

node src/index.js

If all configuration parameters are properly filled in, the example server must work.