1.0.6 • Published 2 years ago
nmmp-captcha v1.0.6
仿captcha模块
下载
npm i nmmp-captcha -S
使用1
npm i nmmp-captcha -S
const svg = require('nmmp-captcha')
let captcha = svg.create({color})
console.log(captcha) // {text:'D3DS', data: '<svg></svg>'}
结合http模块
const http = require('http')
const svg = require('nmmp-captcha')
http.createServer((req, res) => {
res.setHeader('content-type', 'text/html;charset=utf-8')
let captcha = svg.create({color})
// console.log(captcha) // {text:'D3DS', data: '<svg></svg>'}
res.end(captcha.data)
}).listen(3000, () => {
console.log('启动成功, 访问 http://localhost:3000');
})