codersole-captcha
v1.0.1
Published
仿写验证码
Downloads
4
Readme
😀 验证码小物件 - 下载
npm i codersole-captcha -S
😋 验证码小物件 - 使用
const captcha = require('codersole-captcha')
let temp = captcha.create()
console.log(temp) // {text:'D3DS', data: '<svg></svg>'}
😋 验证码小物件 - 结合HTTP模块
// 导入
const http = require('http')
const mycaptcha = require('./captcha')
// 使用
http.createServer((req, res) => {
let captcha = mycaptcha.create('red')
res.setHeader('content-type', 'text/html;charset=utf-8')
res.end(captcha.data)
}).listen(3000, () => {
console.log('启动成功,访问测试http://localhost:3000');
})