npm.io
1.0.8 • Published 4 years ago

webopenlq-captcha

Licence
ISC
Version
1.0.8
Deps
0
Size
4 kB
Vulns
0
Weekly
0

验证码-下载

npm i webopenlq-captcha -S

验证码-使用

const captcha = require('webopenlq-captcha')
let temp = captcha.create()
console.log(temp) // {text:'D3DS', data: '<svg></svg>'}

验证码-结合 http 模块

const http = require('http')
const captcha = require('webopenlq-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');
})