const Client = require('bitcoin-core')
const bodyParser = require('body-parser')

const client = new Client({
  host: process.env.bitcoinHost,
  password: 'bar',
  network: process.env.network,
  username: 'foo'
})

const bitcoinRpcRoute = (app) => {
  app.use('/api/bitcoin', bodyParser.json(), async (req, res) => {
    const {body: {method, rpcArgs}} = req
    try {
      const result = await client[method](...rpcArgs)
      return res.status(200).json(result)
    } catch (e) {
      return res.status(500).json(e)
    }
  })
}

module.exports = bitcoinRpcRoute

@@ -477,16 +477,75 @@
 h (e) %7B%0A
+      // TODO: Better error logging%0A      console.error(e)%0A
       re

Add server error logging on bitcoinRpc