captcha-lvshi
Advanced tools
Comparing version 1.0.4 to 1.0.5
{ | ||
"name": "captcha-lvshi", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "captcha.js", |
@@ -1,19 +0,30 @@ | ||
// cnpm init -y # 生成package.json文件 | ||
// cnpm i svg-captcha -S | ||
# 验证码小物件-下载 | ||
``` | ||
cnpm i captcha-lvshi -S | ||
// 导入 | ||
const http = require('http') | ||
const svgCaptcha = require('./captcha') | ||
// 使用 | ||
``` | ||
# 验证码使用 | ||
``` | ||
const captcha = require('webopenfather-captcha') | ||
let temp = captcha.create() | ||
``` | ||
# 验证码小物件 - 结合HTTP模块 | ||
``` | ||
onst http = require('http') | ||
const captcha = require('webopenfather-captcha') | ||
http.createServer((req, res) => { | ||
let captcha = svgCaptcha.create(30,'pink') | ||
// 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(3000, () => { | ||
console.log('启动成功, 访问测试 http://localhost:3000'); | ||
}) | ||
res.setHeader('content-type', 'text/html;charset=utf-8') | ||
let temp = captcha.create() | ||
// console.log(temp) // {text:'D3DS', data: '<svg></svg>'} | ||
res.end(temp.data) | ||
}).listen(3000, () => { | ||
console.log('启动成功, 访问 http://localhost:3000'); | ||
}) | ||
``` |
3275
30