vesh
Version:
码农nodejs版本VESH框架,使用函数责任链模式 实现了 默认文件跳转,自定义错误页,空文件处理,URL解析,Querystring与Form参数解析,PostFiles解析,MVC自动映射,SQL自动服务化,可继承页面,静态文件,json,tjson,jsonp,tjsonp,string,void,xjson,xjosnp等等6种JSON格式,http与https等等操作
39 lines (35 loc) • 2.33 kB
JavaScript
const VESH = require('./index');
const V = require('gcl');
const F = require('fs');
/**
* Created by baibing on 2016/10/12.
*/
console.log('hello world');
V.isDebug = true;
V.getApplicationConfigManagerFromFile(['test.npcf']).then(cm => {
try {
//V.tryC(() => { console.log(new M.Middler(cm).getObjectByAppName('VESH.view', 'CookieResource')); });
var app = new VESH.App(cm);
app.start(8011);
var httpsapp = new VESH.HttpsApp(cm, F.readFileSync('./ca.key'), F.readFileSync('./ca.crt'));
httpsapp.start(8012);
var http2app = new VESH.Http2App(cm, F.readFileSync('./ca.key'), F.readFileSync('./ca.crt'));
http2app.start(8013);
console.log('启动');
//N.post("http://127.0.0.1:8013", "ac=2223&ccc=哈哈啊哈&bbb=333").then(data => { console.log('下载完成:' + data); }).catch(e => console.log('错误:' + e.toString()));
//console.log("<js>hhefeffe</js>".trim('<js>').trim('</js>'));
//V.forC({},(k,v)=>console.log(v),()=>console.log('finish'));
//N.get("http://www.sohu.com", "").then(data => console.log(data));
//N.post("http://f.zc.com/Module/admin/Test.string","ac=2223&ccc=哈哈啊哈&bbb=333",function(err,data){if(err) console.log(err); else console.log('下载完成:'+data);})
//N.get("http://127.0.0.1:8111/abc.html?_c=0.4258418398972825",function(err,data){if(err) console.err(err); else console.log('下载完成:'+data);})
/*N.postJson("http://127.0.0.1:8111/module/abc.htm?_r=0.4258418398972825", { ac: '2222', ccc: '哈哈啊哈', bbb: '333' }).then(data => {
console.log('下载完成:' + data);
});*/
//todo pm2 判断
//V.callback(F.stat, F, "/Users/baibing/Downloads/公章.jpg").then(stat => console.log(stat));;/Users/baibing/Downloads/公章.jpg
//N.upload("http://www.hengshuiac.org/Module/admin/UploadFile.x?crossDomain=1", '/Users/baibing/Downloads/福岛核辐射.jpg').then(function(data) { console.log('上传完成' + data); });
/*N.upload("http://127.0.0.1:8111/module/abc.htm?_r=0.4258418398972825", "/Users/baibing/Downloads/福岛核辐射.jpg;/Users/baibing/Downloads/公章.jpg").then(function(data) {
console.log('下载完成:' + data);
})*/
} catch (e) { console.log(e); }
});