Files
BreakEscape/config/routes.rb
Z. Cliffe Schreuders a36c0da04e Fix test errors and add route name for room endpoint
- Added 'as: room' to room route to fix room_game_url helper
- Fixed TypeError in initialize_player_state by using .dup instead of .deep_dup
- Simplified npcUnlockedTargets initialization test to avoid edge case
- All 38 tests now passing with 129 assertions
2025-11-22 00:46:56 +00:00

33 lines
1.5 KiB
Ruby

BreakEscape::Engine.routes.draw do
# Static files - caught by routes and served by lightweight controller
# This ensures files are served from the engine's public directory
# Constraint { path: /.*/ } ensures we capture the full path including filename with extension
get '/css/*path', to: 'static_files#serve', constraints: { path: /.*/ }
get '/js/*path', to: 'static_files#serve', constraints: { path: /.*/ }
get '/assets/*path', to: 'static_files#serve', constraints: { path: /.*/ }
get '/stylesheets/*path', to: 'static_files#serve', constraints: { path: /.*/ }
get '/:filename.html', to: 'static_files#serve', constraints: { filename: /test-.*|index/ }
# Mission selection
resources :missions, only: [:index, :show]
# Game management
resources :games, only: [:show, :create] do
member do
# Scenario and NPC data
get 'scenario' # Returns full scenario_data JSON (for compatibility)
get 'scenario_map' # Returns minimal layout metadata for navigation
get 'ink' # Returns NPC script (JIT compiled)
get 'room/:room_id', to: 'games#room', as: 'room' # Returns room data for lazy-loading
get 'container/:container_id', to: 'games#container' # Returns locked container contents
# Game state and actions
put 'sync_state' # Periodic state sync
post 'unlock' # Validate unlock attempt
post 'inventory' # Update inventory
end
end
root to: 'missions#index'
end