Building an API for go-libp2p nodes

Hi, guys!

So I’ve developed a blockchain app based on this tutorial from Medium: https://medium.com/@mycoralhealth/code-a-simple-p2p-blockchain-in-go-46662601f417.

At this stage, the app takes its data from the command line (e.g. BPM), but what I’d want to do is to create an API so that I can use POST to send data to be published in the blockchain and GET to retrieve it.

I’ve managed to do something with gorrila/mux and net/http and run the API on a different port, but data is copied from one package to another and it’s quite unstable and sometimes unresponsive, so I was wondering if it’s a more easy way to do it, as in a library that I can use alongside with go-libp2p for creating and API, or at this point, any idea would help. So far i’ve found go-ipfs-api, but I don’t think it is what i need. Another option might be to use Websockets, so that my API would communicate with my node running in my terminal.

Any thoughts or recommendations will be highly appreciated!