服务端插件: svg-captcha
文档地址:https://github.com/produck/svg-captcha/blob/1.x/README_CN.md
const express = require('express');
const router = express.Router();
// 验证码
const svgCaptcha = require('svg-captcha');
router.get('/', (req, res, next) => {
const capthcha = svgCaptcha.create({
ignoreChars: 'Oo01liI',
noise: 20,
color: true,
});
console.log(capthcha);
res.type('svg');
res.status(200).send(capthcha.data);
});
module.exports = router;