0.0.4 • Published 2 years ago
self-svg-captcha v0.0.4
✨下载
npm i self-svg-captcha -S
✨ 使用
const captcha = require('self-svg-captcha')
let temp = captcha.create()
console.log(temp) // {text:'SIF5', data: '<svg></svg>'}
✨ 结合http模块
const http = require('http')
const captcha = require('self-svg-captcha')
http.createServer((req, res) => {
res.setHeader('content-type', 'text/html;charset=utf-8')
let temp = captcha.create('skyblue',100,60,30,15,25,'rgb(235, 135, 168)')
// 背景颜色/宽/高/字体大小/x轴起点/y轴起点/文字颜色
res.end(temp.data)
}).listen(3000, () => {
console.log('启动成功,请访问:http://localhost:3000');
})