0.0.4 • Published 11 months ago
ethweb v0.0.4
Ethereum Web Services
Install
npm i ethweb --save
Usage Example
when you have a running server
const ethweb = require('ethweb')
const config = {
addr: 3000, //port of your local server (can be anything, but usually expressjs)
privateKey: "0x1234...1234", // generate private key with Metamask or other wallet
tgappsAddress: "ws://SERVER_ADDRESS" // ethweb server
}
ethweb.connect(config,
(err, info)=> {
console.log(err, info)
})
// open 0xYOUR_ADDRESS.manipark.com
// once you refresh your server you will receive instant public updates
when you just have static files
npm i ethweb -g
npm i express -g
const ethweb = require('ethweb')
const express = require('express')
const app = express();
const config = {
addr: 3000,
privateKey: "0x1234...1234", // generate private key with Metamask or other wallet
tgappsAddress: "ws://SERVER_ADDRESS" // ethweb server
staticFilesFolder: './your_static_folder'
}
app
.use(express.static(config.staticFilesFolder))
.listen(config.addr, ()=> {
ethweb.connect(config,
(err, info)=> {
console.log(err, info)
})
})
// open 0xYOUR_ADDRESS.ethweb.org
// once you refresh your server you will receive instant public updates