diff --git a/app/controllers/fruits_controller.rb b/app/controllers/fruits_controller.rb new file mode 100644 index 0000000..0305a7d --- /dev/null +++ b/app/controllers/fruits_controller.rb @@ -0,0 +1,7 @@ +class FruitsController < ApplicationController + def index + # render({ :json => { :message => 'hi', :status => 200 } }) + # render json: message: 'hi', status: 200 # doesn't work because nested objects are unguessable + render json: { message: 'hi', status: 200 } + end +end diff --git a/config/routes.rb b/config/routes.rb index 787824f..144c764 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,3 +1,5 @@ Rails.application.routes.draw do # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html + get '/fruits', to: 'fruits#index' + # get('/fruits', { :to => 'fruits#index' }) end