Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
beego
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
beego
Commits
2a4e2d4a
Commit
2a4e2d4a
authored
Feb 27, 2015
by
astaxie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
delete the group route, because we already has namespace
parent
f96a6285
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
67 deletions
+0
-67
beego.go
beego.go
+0
-67
No files found.
beego.go
View file @
2a4e2d4a
...
...
@@ -42,73 +42,6 @@ const VERSION = "1.4.2"
type
hookfunc
func
()
error
//hook function to run
var
hooks
[]
hookfunc
//hook function slice to store the hookfunc
type
groupRouter
struct
{
pattern
string
controller
ControllerInterface
mappingMethods
string
}
// RouterGroups which will store routers
type
GroupRouters
[]
groupRouter
// Get a new GroupRouters
func
NewGroupRouters
()
GroupRouters
{
return
make
(
GroupRouters
,
0
)
}
// Add Router in the GroupRouters
// it is for plugin or module to register router
func
(
gr
*
GroupRouters
)
AddRouter
(
pattern
string
,
c
ControllerInterface
,
mappingMethod
...
string
)
{
var
newRG
groupRouter
if
len
(
mappingMethod
)
>
0
{
newRG
=
groupRouter
{
pattern
,
c
,
mappingMethod
[
0
],
}
}
else
{
newRG
=
groupRouter
{
pattern
,
c
,
""
,
}
}
*
gr
=
append
(
*
gr
,
newRG
)
}
func
(
gr
*
GroupRouters
)
AddAuto
(
c
ControllerInterface
)
{
newRG
:=
groupRouter
{
""
,
c
,
""
,
}
*
gr
=
append
(
*
gr
,
newRG
)
}
// AddGroupRouter with the prefix
// it will register the router in BeeApp
// the follow code is write in modules:
// GR:=NewGroupRouters()
// GR.AddRouter("/login",&UserController,"get:Login")
// GR.AddRouter("/logout",&UserController,"get:Logout")
// GR.AddRouter("/register",&UserController,"get:Reg")
// the follow code is write in app:
// import "github.com/beego/modules/auth"
// AddRouterGroup("/admin", auth.GR)
func
AddGroupRouter
(
prefix
string
,
groups
GroupRouters
)
*
App
{
for
_
,
v
:=
range
groups
{
if
v
.
pattern
==
""
{
BeeApp
.
Handlers
.
AddAutoPrefix
(
prefix
,
v
.
controller
)
}
else
if
v
.
mappingMethods
!=
""
{
BeeApp
.
Handlers
.
Add
(
prefix
+
v
.
pattern
,
v
.
controller
,
v
.
mappingMethods
)
}
else
{
BeeApp
.
Handlers
.
Add
(
prefix
+
v
.
pattern
,
v
.
controller
)
}
}
return
BeeApp
}
// Router adds a patterned controller handler to BeeApp.
// it's an alias method of App.Router.
// usage:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment