keppel / shea

on-chain client code management for lotion

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Shea

Shea is a simple tool for building and deploying UIs for Lotion applications.

Installation

Shea requires node v7.6.0 or higher.

$ npm install shea

Usage

  1. Write up some html to use as your Lotion app's client.

public/client.html:

<html>
<head>
  <title>my cool app</title>
</head>
<body>
  <p>hello decentralized world</p>
  <script>
    function sendTx(tx) {
      // http post tx to '/txs' to submit it to the blockchain
    }
    function getState() {
      // http get '/state' to get latest blockchain state
    }
  </script>
</body>
</html>
  1. Attach it to a Lotion app.

app.js:

let lotion = require('lotion')
let shea = require('shea')

let app = lotion({ initialState: {} })

app.use(shea('public/'))

app.listen(3000).then(appInfo => {
  console.log(appInfo.GCI)
  // 'f6d671670ce307f71164c7e9b7c1d89c0cf5a6456ddf0a538d59bdbd33216ec5'
})
  1. Run node app.js.

  2. Now clients, on any computer in the world, can run this to connect to your blockchain and open client.html in their browser:

$ npm i -g shea
$ shea <GCI>

That's it!

License

MIT

About

on-chain client code management for lotion


Languages

Language:JavaScript 87.5%Language:HTML 12.5%