weaveworld

0.14.190517 • Public • Published

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';

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i weaveworld

      Weekly Downloads

      1

      Version

      0.14.190517

      License

      For weaveworld-app: MIT. For Weaveworld: SEE LICENSE IN 'public/LICENSE' file

      Unpacked Size

      69.4 kB

      Total Files

      6

      Last publish

      Collaborators

      • weaveworld