@platformatic/rpc-cli
v2.11.0
Published
A fastify RPC plugin for typescript applications
Downloads
1,369
Keywords
Readme
Platformatic RPC CLI
Fastify CLI command to generate a server RPC api for a Fastify application.
[!WARNING]
Platformatic RPC API is in the experimental stage. The feature is not subject to semantic versioning rules. Non-backward compatible changes or removal may occur in any future release. Use of the feature is not recommended in production environments.
Installation
npm install @platformatic/rpc-cli
npm install --save-dev @platformatic/rpc-cli
Usage
Register an RPC plugin in your Fastify typescript application. See the Platformatic RPC documentation for more information.
Run the CLI command to generate the OpenAPI schema.
npx plt-rpc --ts-config ./tsconfig.json --path ./openapi.json
- Start the Fastify application.
Your RPC handlers are exposed as http routes under the /rpc
prefix. All RPC routes are POST routes.
curl -X POST http://localhost:3042/rpc/getUsers -H 'Content-Type: application/json' -d '{"maxAge": 30}'