Reputation: 785
Am I able to call my ruby backend functions from my grpc server? I have a standard rails app that I am now trying to add grpc to so that outside apps can call a grpc api endpoint to do things through my existing app. Right now I have a standard file structure with app/components, app/models, etc and at the root I have added a /grpc directory with the server, lib, and a protos folder as well. My question is, on the server how can I call my existing ruby functions in my app?
For instance how could I do a call from my grpc server to a class like MyModule::MyClass.store_this_thing_to_the_db(parameter).
Folder Structure Example: /grpc/grpc_server.rb (I want to call the class from here) /app/models/my_model (I want to call this class)
Upvotes: 0
Views: 210
Reputation: 494
In grpc_server.rb require_relative
the rb file containing the store_this_thing_to_the_db
function and call.
Upvotes: 1