Skip to content

FabricLabs/fabric-http

Repository files navigation

@fabric/http — HTTP support for Fabric applications

Project Status Coverage Status GitHub contributors Community

Robust library for implementing Fabric-enabled Web Applications.

TODO

  • Replace Fabric-enabled with Bitcoin-enabled

Quick Start

Building applications with @fabric/http is easy.

mkdir myapp && cd myapp
npm init
npm i --save @fabric/http

Create an application by creating a new file (here we've used scripts/app.js), containing the following:

scripts/app.js:

'use strict';

const SPA = require('@fabric/http/types/spa');

async function main () {
  const spa = new SPA({
    name: 'Example App',
    synopsis: 'Simple demonstration of a single-page app.',
    resources: {
      'Todo': {
        description: 'A to-do list item.'
      }
    }
  });

  await spa.start();
}

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/app.js to start the app, or webpack scripts/app.js -o assets/app.min.js to build a browser version.

Advanced: @maki/roller

Maki, making beautiful apps a breeze

Try maki roll examples in this repo for a mind-blowing experience.