1.0.1 • Published 2 years ago

jessica-captcha v1.0.1

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

下载

npm i jessica-captcha-S

导入

const captcha = require('jessica-captcha')
let temp = captcha.create()
console.log(temp)     

结合http模块使用

const http = require('http')
const captcha = require('jessica-captcha')

http.createServer((req, res) => {
    res.setHeader('content-type', 'text/html;charset=utf-8')
    let temp = captcha.create({ 
        fontSize: 48, // 字体大小 
        width: 100, // 宽度 
        height: 40, // 高度 
        background: "#f4f3f2",   //背景颜色
        color: true // 验证码的字符是否有颜色,默认没有,如果设定了背景,则默认有     
        }); 
    res.end(temp.data)
}).listen(3000, () => {
    console.log('启动成功, 访问  http://localhost:3000');
})