Last active
June 26, 2019 15:38
-
-
Save 99darwin/8bd83fd27fc0a139dc2447831b250061 to your computer and use it in GitHub Desktop.
Divid api example for node-rpc-tutorial
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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