ApiExplorer
This project is intended to be mounte on an existing Rails Application.
The only precondition is that it requires a multithreaded rails server.
Instructions:
-
gem ‘thin’, ‘~> 1.6.1’
-
bundle install
-
Add to development.rb (or production.rb): config.thread_safe!
Create a file named ws_specification.json (or any name you desire) and place it on /lib.
As an example:
{ “methods”: [ { “name”: “Users index”, “url”: “v1/users”, “description”: “The index of users”, “method”: “GET”, “parameters”: [“API_TOKEN”] }, { “name”: “User login”, “url”: “v1/users/login”, “description”: “Users login”, “method”: “POST”, “parameters”: [“API_TOKEN”, “email”, “password”] } ] }
Create an initializer in /config/initializers/api_explorer.rb with the following content:
ApiExplorer::use_file = true ApiExplorer::json_path = ‘lib/ws_specification.json’
And finally mount the engine on config/routes.rb
mount ApiExplorer::Engine => “/api_explorer”
-
Start the server with “thin start –threaded”
Then go to localhost:3000/api_explorer