Skip to content

Simultaneous use of RPC and OpenAPI handlers #651

Closed Answered by dosubot bot
rhinodavid asked this question in Q&A
Discussion options

You must be logged in to vote

There isn't a single-file example in the repo that shows both RPCHandler and OpenAPIHandler in one server, but the playgrounds for frameworks like Next.js and SvelteKit show the idiomatic pattern: mount RPCHandler at /rpc and OpenAPIHandler at /api. Each handler is set up in its own route file, and both can coexist cleanly this way—no hacks needed. You can see this pattern in the Next.js playground for RPCHandler and OpenAPIHandler.

If you want OpenAPIHandler at / instead of /api, you can just change the prefix in the handler config and route file. The project doesn't recommend against this, but /api is the default in the playgrounds. This setup is clean, maintainable, and lets you serve…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by unnoq
Comment options

You must be logged in to vote
1 reply
@dosubot
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant