kurenn / sabisu-rails

Simple and powerful engine for exploring your Rails api application
MIT License
127 stars 29 forks source link

Net::ReadTimeout in SabisuRails::ExplorerController#index #46

Open pdkproitf opened 7 years ago

pdkproitf commented 7 years ago

Hey everybody. I got a error when i try to make api on raill follow this book http://apionrails.icalialabs.com/book/ Please help me. And I found the same roblem at issues #30 but It closed with no solution. So what going on with this errors. screenshot from 2016-12-07 12-11-23

kurenn commented 7 years ago

Hi @pdkproitf ,

What is the version of Rails you are using?

pdkproitf commented 7 years ago

I using rails 5.

kurenn commented 7 years ago

I have not tested yet with Rails 5, I can give it a spin on the weekend, but for what I can see it has to do with a dependency from the gem, how does your initializer look like?

fabOnReact commented 6 years ago

@kurenn

I have the same problem with rails 4.0.2

this is my routes.rb

Rails.application.routes.draw do
  mount SabisuRails::Engine => "/sabisu_rails"
    namespace :api, defaults: { format: :json } do
        namespace :v1 do
            devise_for :users
            resources :users, :only => [:show, :create, :update, :destroy]
        end
    end
end

this is my sabisu_rails.rb

# Use this module to configure the sabisu available options

SabisuRails.setup do |config|

  # Base uri for posting the 
  config.base_api_uri = 'localhost:3000' 

  # Ignored attributes for building the forms
  # config.ignored_attributes = %w{ created_at updated_at id }

  # HTTP methods
  # config.http_methods = %w{ GET POST PUT DELETE PATCH }

  # Headers to include on each request
  #
  # You can configure the api headers fairly easy by just adding the correct headers
  # config.api_headers = { "Accept" => "application/json,application/vnd.application.v1" }
  #
  # config.api_headers = {}

  # Layout configuration
  # config.layout = "sabisu"

  # Resources on the api
  # config.resources = [:products, :users...]
  config.resources = [:users]

  # Default resource
  config.default_resource = 'users'

  # Application name
  # mattr_accessor :app_name
  # @@app_name = Rails.application.class.parent_name

  # Authentication
  # mattr_accessor :authentication_username
  # @@authentication_username = "admin"

  # mattr_accessor :authentication_password
  # @@authentication_password = "sekret"

end

also I dont know how I should configure my base_api_uri as my routes are just localhost:3000/api/vi/users

if I don't set the config.base_api_uri I will have the following error

Errno::ECONNREFUSED in SabisuRails::ExplorerController#index
Failed to open TCP connection to :80 (Connection refused - connect(2) for nil port 80)

also I noted that I did not install pow because I am just not using this http://market_place_api.dev/ in localdevelopment, also I use linux so I just skipped that part...

Thanks a lot for the guide