1.0.0 • Published 2 years ago
webmonaiwx-daoru v1.0.0
⭐️ 验证码小物件 - 下载
npm i webmonaiwx -S
🌰 验证码小物件 - 使用
const captcha = require('webmonaiwx')
let temp = captcha.create()
console.log(temp) // {text:'D3DS', data: '<svg></svg>'}
🌰 验证码小物件 - 结合 HTTP 模块
const http = require("http");
const svgCaptcha = require("webmonaiwx");
// 使用
http
.createServer((req, res) => {
let captcha = svgCaptcha.create();
// console.log(captcha); // {data, text}
// res.setHeader('content-type', 'text/html;charset=utf-8')
res.setHeader("content-type", "image/svg+xml");
res.end(captcha.data);
})
.listen(3003, () => {
console.log("启动成功, 访问测试 http://localhost:3000");
});
1.0.0
2 years ago