0.0.7 • Published 11 months ago
tgapps v0.0.7
TGAPPS
Install
npm i tgapps --save
Usage Example
when you have a running server
const tgapps = require('tgapps')
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" // tgapps server
}
tgapps.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 tgapps -g
npm i express -g
const tgapps = require('tgapps')
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" // tgapps server
staticFilesFolder: './your_static_folder'
}
app
.use(express.static(config.staticFilesFolder))
.listen(config.addr, ()=> {
tgapps.connect(config,
(err, info)=> {
console.log(err, info)
})
})
// open 0xYOUR_ADDRESS.manipark.com
// once you refresh your server you will receive instant public updates