You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I dont know if i can ask this here, but here it go.
I want to make an API with js-libp2p. I know that I can handle a protocol simply using handle function, but it do not give responses. For example: If i make a request to /api/resources/ i want to get a list of resources (ok, i do have procedures to get those resources from database e.g ). I just want to give a json (object) response.
Is there a way to do that?
If its not possible, i was planning to make a kind of handshake to deal with communications between a pair of peers.
The text was updated successfully, but these errors were encountered:
Hrm... no. If I understand your question correctly you want to use protocol identifiers as RPC endpoints? In that case, that's not the correct usage. Even tho it might look like an endpoint name, it's not that, /api/resource is a multistream protocol name identifier, using it as some sort of RPC endpoint would not be the correct thing to do.
As for returning a JSON or any other data from your handler, you can but it has to be piped to the provided connection stream.
I dont know if i can ask this here, but here it go.
I want to make an API with js-libp2p. I know that I can handle a protocol simply using handle function, but it do not give responses. For example: If i make a request to /api/resources/ i want to get a list of resources (ok, i do have procedures to get those resources from database e.g ). I just want to give a json (object) response.
Is there a way to do that?
If its not possible, i was planning to make a kind of handshake to deal with communications between a pair of peers.
The text was updated successfully, but these errors were encountered: