Skip to content
πŸ”’ An API for generating CAPTCHAs from scratch (Node.js)
JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github/workflows
test Refactor tests to include checking validation string Nov 12, 2019
.gitignore
LICENSE
README.md Add blog post link Nov 11, 2019
app.js Add filename header comments Nov 10, 2019
captcha.js Add back canvas import Nov 10, 2019
package-lock.json
package.json Add captcha generation, express server, tests Nov 10, 2019
preview.jpg Add preview Nov 10, 2019
server.js

README.md

CAPTCHA API

My blog post: Let's Build a CAPTCHA Generator with Node.js


πŸ”’ Keep those nasty bots out with a home-grown CAPTCHA!


Install

npm i

Run

npm start

API

All routes default to 200x100 size unless specified.

  • /test/:width?/:height?/

    • Get a web page with an image element to manually test the API.
  • /captcha/:width?/:height?/

    • Get a CAPTCHA object for proper usage.
    • { "image": <data url>, "text": <validation text> }

Test

Uses Jest to run integration tests.

npm test


n.b. CAPTCHAs are not accessible and in some cases not even effective.

You can’t perform that action at this time.