File tree Expand file tree Collapse file tree 1 file changed +14
-13
lines changed Expand file tree Collapse file tree 1 file changed +14
-13
lines changed Original file line number Diff line number Diff line change @@ -109,23 +109,24 @@ func main() {
109
109
e.Get("/users", getUsers)
110
110
e.Get("/users/:id", getUser)
111
111
112
- //****************//
113
- // Sub router //
114
- //****************//
115
- // Sub - inherits parent middleware
116
- sub := e.Sub("/sub")
117
- sub.Use(func(c *echo.Context) { // Middleware
112
+ //***********//
113
+ // Group //
114
+ //***********//
115
+ // Group with parent middleware
116
+ a := e.Group("/admin")
117
+ a.Use(func(c *echo.Context) {
118
+ // Security middleware
118
119
})
119
- sub .Get("/home ", func(c *echo.Context) {
120
- c.String(http.StatusOK, "Sub route /sub/welcome ")
120
+ a .Get("", func(c *echo.Context) {
121
+ c.String(http.StatusOK, "Welcome admin! ")
121
122
})
122
123
123
- // Group - doesn't inherit parent middleware
124
- grp := e.Group("/group")
125
- grp.Use(func(c *echo.Context) { // Middleware
124
+ // Group with no parent middleware
125
+ g := e.Group("/files", func(c *echo.Context) {
126
+ // Security middleware
126
127
})
127
- grp .Get("/home ", func(c *echo.Context) {
128
- c.String(http.StatusOK, "Group route /group/welcome ")
128
+ g .Get("", func(c *echo.Context) {
129
+ c.String(http.StatusOK, "Your files! ")
129
130
})
130
131
131
132
// Start server
You can’t perform that action at this time.
0 commit comments