Skip to content

Commit e5bdcea

Browse files
author
Vishal Rana
committed
Update README.md
1 parent 0552008 commit e5bdcea

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

README.md

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -109,23 +109,24 @@ func main() {
109109
e.Get("/users", getUsers)
110110
e.Get("/users/:id", getUser)
111111

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
118119
})
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!")
121122
})
122123

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
126127
})
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!")
129130
})
130131

131132
// Start server

0 commit comments

Comments
 (0)