我的本地主机上有3000个应用程序在端口3000和9000(rails 2和sinatra app)上运行。
我在app/controllers/finance_service.rb
class FinanceServiceController < ApplicationController
def after_token_create
p "after token create function: #{params.inspect}"
end
end
并设置了这样的路线:
map.finance_service '/finance_service' , :controller => "finance_service", :action => "after_token_create"
当我在网址http://localhost:3000/finance_service
我在模板丢失时遇到错误,但这很好,因为这意味着路由正在运行(我将其用作另一个应用程序的服务API)。
尝试使用httparty gem
从其他应用程序访问该方法时如此:
HTTParty.post("http://localhost:3000/FinanceServiceController/after_token_create", :body => post_params)
我在rails app-
上收到错误myapp/public/404.html (method_not_allowed)
还尝试从高级Rest客户端应用程序,我得到相同的错误。
答案 0 :(得分:0)
请求不应该是这样的吗?因为路由匹配器是/ finance_service
HTTParty.post("http://localhost:3000/finance_service", :body => post_params)