Skip to content

Instantly share code, notes, and snippets.

@99darwin
Last active June 26, 2019 15:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 99darwin/8bd83fd27fc0a139dc2447831b250061 to your computer and use it in GitHub Desktop.
Save 99darwin/8bd83fd27fc0a139dc2447831b250061 to your computer and use it in GitHub Desktop.
Divid api example for node-rpc-tutorial
const RpcClient = require('divid-rpc')
const config = require('./config')
module.exports = app => {
const rpc = new RpcClient(config.config)
app.get('/blockcount', (req, res) => {
rpc.getBlockCount((err, response) => {
if (err) {
console.error(err)
} else {
res.json({blockcount: response.result})
}
})
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment