我正在使用Luracast Restler API框架,並想知道如何組織類結構來創建這種類型的路由。如何組織Luracast Restler類來創建相關的路由端點?
webroot/user/:id/
webroot/user/:id/profile
webroot/user/:id/tweets
對於使用GET,PUT,POST的可能性,刪除每個:
Class user(){
function get($id){
Do something when GET/webroot/user/:id/
}
function put($data){
Do something when PUT/webroot/user/:data/
}
}
Class profile(){
function get($id){
Do something when GET/webroot/user/:id/profile
}
}
Class tweets(){
function get($id){
Do something when GET/webroot/user/:id/tweets
}
}
提前感謝!
你嘗試過什麼到目前爲止?向一個你遇到過具體的問題嗎?官方的規範是什麼,你的課程是否適用? – hakre