1.0.1 • Published 2 years ago
yzm-captcha v1.0.1
随机生成验证码 -- 下载 💦
npm i yzm-captcha -S
随机生成验证码 -- 使用 🤙🏻
const captcha = require('yzm-captcha')
let temp = captcha.create()
console.log(temp) // {text:'D3DS', data: '<svg></svg>'}
随机生成验证码 -- 结合HTTP模块 🤙🏻
const http = require('http')
const captcha = require('yzm-captcha')
http.createServer((req, res) => {
res.setHeader('content-type', 'text/html;charset=utf-8')
let temp = captcha.create("")//直接写颜色 改变文字颜色
// console.log(temp) // {text:'D3DS', data: '<svg></svg>'}
res.end(temp.data)
}).listen(3000, () => {
console.log('启动成功, 访问 http://localhost:3000');
})