athena-framework / athena

An ecosystem of reusable, independent components
https://athenaframework.org
MIT License
211 stars 17 forks source link

Normalize controller routes when merged with route prefix #308

Closed Blacksmoke16 closed 1 year ago

Blacksmoke16 commented 1 year ago
require "athena"

@[ARTA::Route(path: "/api")]
class Users < ATH::Controller
  @[ARTA::Get("")]
  def list : String
    "list"
  end

  @[ARTA::Get("{id}")]
  def index(id : Int32) : Int32
    id
  end
end

ATH.run

Fixes the #index method's path previously being /api{id} and instead normalizes it to be the expected /api/{id} path.