1

Generally a response from tRPC server looks like:

{
    "result": {
        "data": "OK!"
    }
}

But what I need is only:

OK!

How do I attain this?

Sorry for asking this silly question. I'm new to this tRPC thing and still figuring things out.

stack5
  • 430
  • 2
  • 10
  • I dont think this is possible. See: https://trpc.io/docs/rpc#http-response-specification Also kinda curious why do you want something like that. – danzel artamadja Apr 19 '23 at 18:32
  • Thanks @danzel. I wanted to have a separate api for metrics which can be directly consumed by prometheus and the JSON response is causing a bit of hindrance. – stack5 Apr 21 '23 at 08:26
  • You could use trpc-openapi - https://github.com/jlalmes/trpc-openapi. But that might be a bit overkill for your use case – Samuel Newman Apr 22 '23 at 11:43

1 Answers1

0

I had the similar need, here is what i did

  1. created httpHandler.
  2. and when you create http server handle your request as per your need (setting content type etc), and when you are done, use the handler you have created.

From here i took reference https://trpc.io/docs/server/adapters/standalone#going-further