Middleware to make inner redirect for Json-Rpc requests.
gem install json-rpc2rest
or add the following line to Gemfile:
gem 'json-rpc2rest'
and run bundle install
from your shell.
After that add line to config/application.rb
config.middleware.use 'Json-Rpc2Rest'
Also you can specify field with method name
config.middleware.use 'Json-Rpc2Rest', field: 'requestMethod'
Default field is "method"
as in specification.
# config/application.rb
config.middleware.use 'JsonRpcToRest'
Post request to /api
with params
{"method": "get_posts_list", "data": [], "id": 2}
will be processed as /api/get_posts_list
with same params.
git clone https://github.com/dzjuck/json-rpc2rest.git
cd json-rpc2rest
bundle install
rspec
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Added some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request