Make RPC Calls with Adonis and rpc

Am using Adonis to build a Bitcoin RPC system, so am making request with request.js Lib, so but the issue is with the callback when I make the request it works but I can’t see send the response to the web endpoint, when I console the response from the RPC server it works fine but on postman it is blank.

const request = require("request");
getBlockCount({ response}){
    const dataString = `{"jsonrpc":"1.0","id":"curltext","method":"getblockcount","params":[]}`;
    const options = {
        url: `http://${USER}:${PASS}@${HOST}:${PORT}/`,
        method: "POST",
        headers: headers,
        body: dataString
    const returnData;
    const callback = (error, nextRes, body) => {
      if (!error && nextRes.statusCode == 200) {
        const data = JSON.parse(body);
        returnData = data;
      return response.send('data');
    return request(options, callback);
    // const options = requestOption(dataString);
    // console.log(rpcRequest(options, callBack(response)));


I think I answered it somewhere, but I’ll answer in here again :slight_smile:

If dealing with callbacks you have to promisify it or set implicitEnd to false