1.0.2 • Published 2 years ago

webdickfacecat-captcha v1.0.2

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

下载

npm init -y    # 生成package.json文件
cnpm i webdickfacecat-captcha -S

使用

// 导入
const http = require('http')
const svgCaptcha = require('webdickfacecat-captcha')
// 使用

http.createServer((req, res) => {

    let captcha =svgCaptcha.create()
    // console.log(captcha); // {data, text}
 
    res.setHeader('content-type', 'text/html;charset=utf-8')
    res.end(captcha.data)
}).listen(3000, () => { 
    console.log('启动成功, 访问测试 http://localhost:3000');
})