From 2abe584bc5fd0cdd250ab8cdc86cfff3d6b4ff1b Mon Sep 17 00:00:00 2001 From: astaxie Date: Mon, 8 Jul 2013 18:35:10 +0800 Subject: [PATCH] support restful router --- beego.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/beego.go b/beego.go index b6dda501..f32d948d 100644 --- a/beego.go +++ b/beego.go @@ -180,8 +180,14 @@ func RegisterController(path string, c ControllerInterface) *App { return BeeApp } -func Router(path string, c ControllerInterface) *App { - BeeApp.Router(path, c) +func Router(rootpath string, c ControllerInterface) *App { + BeeApp.Router(rootpath, c) + return BeeApp +} + +func RESTRouter(rootpath string, c ControllerInterface) *App { + Router(rootpath, c) + Router(path.Join(rootpath, ":objectId"), c) return BeeApp }