View Source PhxJsonRpc.Router (Phoenix JSON RPC v0.2.2)
The entrypoint for defining rpc routes.
config
Config
schema
- specifies path to your json-schema file.version
- jsonrpc version.max_batch_size
- maximum number of requests per batch.
example
Example
defmodule MyRpcRouter do
use PhxJsonRpc.Router,
schema: "[PATH_TO_OPENRPC_SCHEMA]",
version: "2.0",
max_batch_size: 20
rpc("greet", HelloController, :hello)
end
Link to this section Summary
Functions
Generates rpc route match based on the open-rpc schema parameters.
Link to this section Functions
Generates rpc route match based on the open-rpc schema parameters.
arguments
Arguments
method
- the name of the calling method.controller
- resolving module, often a controller.action
- resolving function in controller.schema_ref
- reference inside json schema, used for request params validation.
examples
Examples
rpc("hello", HelloController, :hello)
rpc("pet_create", PetController, :create, "#/components/schemas/NewPet")