我的api已经准备好了。现在,我想将swagger与我的api集成在一起
我正在使用这个gem https://github.com/ruby-grape/grape-swagger-rails
但我在浏览器控制台中遇到错误
swagger-ui.min.js?body=1:9 GET http://localhost:3001/swagger_doc.json 404 (Not Found)
Unable to Load SwaggerUI帮我解决这个问题谢谢。
发布于 2016-11-06 06:52:45
您是否尝试在before_action中为每个请求设置app_url。这对我有帮助。只需将以下代码添加到config/initializers/swagger.rb
GrapeSwaggerRails.options.before_action do
GrapeSwaggerRails.options.app_url = request.protocol + request.host_with_port
end
GrapeSwaggerRails.options.url = '/swagger_doc.json'
GrapeSwaggerRails.options.app_url = 'http://swagger.wordnik.com'https://stackoverflow.com/questions/40278269
复制相似问题