weaveworld
v0.14.190517
Published
Weaveworld, full-scale JavaScript framework for web applications
Downloads
3
Readme
Weaveworld
Using Weaveworld with Node.js and Express.
License for weaveworld Node.js module: MIT.
License for Weaveworld: see 'public/LICENSE' file or here.
Direct access for w.min.js
and w.css
.
<script src="w.min.js"></script>
<link href="w.css" rel="stylesheet"/>
Example:
const app=require('express')(), bodyParser=require('body-parser');
const weaveworld=require('weaveworld')
app.listen(3000);
app.use(bodyParser.urlencoded({extended: false}));
app.use(bodyParser.json());
// Optional: publishing files from a folder, too
weaveworld.dir=__dirname+'/public';
// Optional: handling REST API requests
app.route('/tasks')
.get(function(req,res){
res.send([{name:'Task1'},{name:'Task2'}]);
});
// ...
// Optional: handling ONCE-style server calls
weaveworld.op('hello').then(o=>({message:'Hello '+(o.name||'World')+'!'}));
// ...
// Mandatory: set routing
app.all('/*',weaveworld.route);
Publishing files from a directory.
E.g.,
weaveworld.dir=__dirname+'/public';