Add api/v1/parks

This commit is contained in:
2025-10-07 22:09:41 -07:00
parent f670c4e589
commit 16f851b721
4 changed files with 20 additions and 2 deletions

View File

@@ -0,0 +1,5 @@
class Api::V1::ParksController < ApplicationController
def index
render json: Park.all
end
end

View File

@@ -1,4 +1,9 @@
Rails.application.routes.draw do Rails.application.routes.draw do
namespace :api do
namespace :v1 do
resources :parks, only: %i[index]
end
end
# Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html # Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html
# Reveal health status on /up that returns 200 if the app boots with no exceptions, otherwise 500. # Reveal health status on /up that returns 200 if the app boots with no exceptions, otherwise 500.

View File

@@ -0,0 +1,8 @@
require "test_helper"
class Api::V1::ParksControllerTest < ActionDispatch::IntegrationTest
test "should get index" do
get api_v1_parks_url
assert_response :success
end
end

View File

@@ -4,10 +4,10 @@ one:
code: crla code: crla
name: Crater Lake National Park name: Crater Lake National Park
states: OR states: OR
properties: properties: {}
two: two:
code: olym code: olym
name: Olympic National Park name: Olympic National Park
states: WA states: WA
properties: properties: {}