Introduction
Simplicity is the ultimate sophistication.
- Less dependence(no any external dependence)
- Less code(about 400 line pure javascript code)
- High performance(5k+ tps on one core)
- Perfect foundation support
- full express style router
- default query body(post) parser
- webwork(java) style interceptor
- Automatic bigpiple optimization support
How To Use
install
$ npm install webwork
hello world
//use shared webwork instance and bind any http method to any urlvar app = ;app;start8080
Full Examples
//new webwork instanceconst WW = ;const app = ; //bind default view resolverlet LiteEngine = ;let engine = './';app //bind a resource as restfull apiapp; //bind get http method for any other url and use template: '/success.xhtml'app; appstart;
Use Template
lite template is recomanded
- auto bigpiple support
- auto bigrender support
- and others....
let LiteEngine = ;let engine = './';app
for others
const path = require('path');
const jade = require('jade');
const jadeRoot = './jade/';
app.resolveView('*.xhtml',function*(viewPath,model,req,out){
for(var n in model){
model[n] = yield model[n];
}
// renderFile
const tplFile = path.join(jadeRoot,viewPath);
const html = jade.renderFile(tplFile, model);
out.end(html)
})