我正在爲我的投資組合製作一個簡單的Sinatra靜態網站。Sinatra - 製作嵌套的URL?
我想/profile
下幾頁像/profile/history
和/profile/education
通過下面的官方文檔,我可以做到這一點:
get "/profile/history" do
...
end
get "/profile/education" do
...
end
它變得多餘。有沒有DRY這樣做?也許增加一個class
什麼的?
感謝
完美!如何調用模板?該模板位於'/ profile'子目錄中,並將其稱爲我使用'erb:'profile/history''。任何避免寫入子目錄的方法?再次感謝 – hrsetyono
似乎'Sinatra :: Namespace'不知道模板子目錄。你嘗試過'erb:history'嗎? – davogones
我試過'erb:history',它不起作用。我必須指定子目錄'erb:'profile/history''。那就夠了。非常感謝 – hrsetyono