Robust library for implementing Fabric-enabled Web Applications.
Fabric is an attempt at replicating the World Wide Web ("the WWW") as a peer-to-peer network, using payment relationships to exchange documents and scale the network. @fabric/http
provides a framework for hosting Fabric-enabled applications over HTTP, allowing them to be used as "edge servers" for legacy web users.
Building applications with @fabric/http
is easy.
mkdir some-project && cd some-project
npm init # Initialize the project
npm i --save @fabric/http # Install the @fabric/http dependency
Create an application by creating a new file (here we've used scripts/node.js
), containing the following:
'use strict';
// Dependencies
const SPA = require('@fabric/http/types/spa');
// Main Process
async function main () {
const spa = new SPA({
name: 'Example Application',
synopsis: 'Simple demonstration of a single-page application.',
resources: {
'Todo': {
description: 'A to-do list item.'
}
}
});
// Start the Process
await spa.start();
// Return reference
return { id: spa.id };
}
main().catch((exception) => {
console.log('[FABRIC-HTTP:EXAMPLE] Main Process Exception:', exception);
}).then((output) => {
console.log('[FABRIC-HTTP:EXAMPLE] Main Process Output:', output);
});
Run node scripts/node.js
to start the app, or webpack scripts/app.js -o assets/app.min.js
to
build a browser version.