Comment on page

JSON-RPC Methods

JSON-RPC is the default way of invoking the methods in genezio. JSON-RPC methods use the JSON-RPC 2.0 specification. When a method is declared as JSON-RPC, it can have any number of parameters and it can return any type. This is an example of a class containing a JSON-RPC method.
export class HelloWorldService {
hello(name, from) {
console.log(`Hello world request received with name ${name} from ${from}!`)
return `Hello, ${name}, from ${from}!`
After the code is deployed using genezio deploy or when testing locally using genezio local, the method can be called using the autogenerated SDK.
await HelloWorldService.hello("World", "genezio")
The SDK will compose the JSON-RPC request and it will send it to the deployed function.